Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

IndexReader.deleteDocuments

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


ekemokai at gmail

Oct 14, 2006, 9:49 PM

Post #1 of 5 (954 views)
Permalink
IndexReader.deleteDocuments

Hi guys,
I am a newbee so excuse me if this is a repost. From the javadoc it seems
Reader.deleteDocuments deletes only documents that have the provided term,
but the implementation examples that I have seen and from the behaviour of
my own app, deleteDocuments(term) deletes documents that don't have the
given term. Can someone clarify this for me?

Thanks
Edmond Kemokai.


"talk trash and carry a small stick."
PAUL KRUGMAN (NYT)


otis_gospodnetic at yahoo

Oct 14, 2006, 11:06 PM

Post #2 of 5 (902 views)
Permalink
Re: IndexReader.deleteDocuments [In reply to]

The javadoc is right. :)

Otis

----- Original Message ----
From: EDMOND KEMOKAI <ekemokai[at]gmail.com>
To: java-user[at]lucene.apache.org
Sent: Sunday, October 15, 2006 12:49:21 AM
Subject: IndexReader.deleteDocuments

Hi guys,
I am a newbee so excuse me if this is a repost. From the javadoc it seems
Reader.deleteDocuments deletes only documents that have the provided term,
but the implementation examples that I have seen and from the behaviour of
my own app, deleteDocuments(term) deletes documents that don't have the
given term. Can someone clarify this for me?

Thanks
Edmond Kemokai.


"talk trash and carry a small stick."
PAUL KRUGMAN (NYT)




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe[at]lucene.apache.org
For additional commands, e-mail: java-user-help[at]lucene.apache.org


ekemokai at gmail

Oct 14, 2006, 11:35 PM

Post #3 of 5 (904 views)
Permalink
Re: IndexReader.deleteDocuments [In reply to]

Thanks for the response Otis, below is a link to the javadoc in the API:

http://lucene.apache.org/java/docs/api/org/apache/lucene/demo/DeleteFiles.html
( Deletes documents from an index that do not contain a term)

Here is a link to the actual sample implementation:
http://svn.apache.org/repos/asf/lucene/java/trunk/src/demo/org/apache/lucene/demo/DeleteFiles.java

In the file above you have code that looks like this:

Term term = new Term("path", args[0]);
int deleted = reader.deleteDocuments(term);

So in effect it should delete documents that don't contain the "path" value
correspoding to what's in args[0]. Except the API documentation suggests the
opposite. In other words the above code should delete only documents
containing "path" values equal to args[0] (this is obviously more
intuitive). Here is the API doc for what the above code snippet should do:

(
http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#deleteDocuments(org.apache.lucene.index.Term)
):

Deletes all documents containing term. This is useful if one uses a document
field to hold a unique ID string for the document. Then to delete such a
document, one merely constructs a term with the appropriate field and the
unique ID string as its text and passes it to this method. See
deleteDocument(int)<http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#deleteDocument%28int%29>for
information about when this deletion will become effective.



From observation in my app, it is deleting documents that don't have the
provided term, which means there's no easy way to delete a doc (other than
iterating) even if you have a unique id.

On 10/15/06, Otis Gospodnetic <otis_gospodnetic[at]yahoo.com> wrote:
>
> The javadoc is right. :)
>
> Otis
>
> ----- Original Message ----
> From: EDMOND KEMOKAI <ekemokai[at]gmail.com>
> To: java-user[at]lucene.apache.org
> Sent: Sunday, October 15, 2006 12:49:21 AM
> Subject: IndexReader.deleteDocuments
>
> Hi guys,
> I am a newbee so excuse me if this is a repost. From the javadoc it seems
> Reader.deleteDocuments deletes only documents that have the provided term,
> but the implementation examples that I have seen and from the behaviour of
> my own app, deleteDocuments(term) deletes documents that don't have the
> given term. Can someone clarify this for me?
>
> Thanks
> Edmond Kemokai.
>
>
> "talk trash and carry a small stick."
> PAUL KRUGMAN (NYT)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe[at]lucene.apache.org
> For additional commands, e-mail: java-user-help[at]lucene.apache.org
>
>


--
"talk trash and carry a small stick."
PAUL KRUGMAN (NYT)


ekemokai at gmail

Oct 15, 2006, 9:01 PM

Post #4 of 5 (897 views)
Permalink
Re: IndexReader.deleteDocuments [In reply to]

Can somebody please clarify the intended behaviour of
IndexReader.deleteDocuments()?, between the various documentations and
implementations it seems this function is broken. API doc says it should
delete docs containing the provided term but instead it deletes all
documents not containg the given term.

On 10/15/06, EDMOND KEMOKAI <ekemokai[at]gmail.com> wrote:
>
> Thanks for the response Otis, below is a link to the javadoc in the API:
>
> http://lucene.apache.org/java/docs/api/org/apache/lucene/demo/DeleteFiles.html
>
> ( Deletes documents from an index that do not contain a term)
>
> Here is a link to the actual sample implementation:
>
> http://svn.apache.org/repos/asf/lucene/java/trunk/src/demo/org/apache/lucene/demo/DeleteFiles.java
>
> In the file above you have code that looks like this:
>
> Term term = new Term("path", args[0]);
>
> int deleted = reader.deleteDocuments(term);
>
> So in effect it should delete documents that don't contain the "path"
> value correspoding to what's in args[0]. Except the API documentation
> suggests the opposite. In other words the above code should delete only
> documents containing "path" values equal to args[0] (this is obviously more
> intuitive). Here is the API doc for what the above code snippet should do:
>
> (http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#deleteDocuments(org.apache.lucene.index.Term)
>
> <http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#deleteDocuments%28org.apache.lucene.index.Term%29>
> ):
>
> Deletes all documents containing term. This is useful if one uses a
> document field to hold a unique ID string for the document. Then to delete
> such a document, one merely constructs a term with the appropriate field and
> the unique ID string as its text and passes it to this method. See
> deleteDocument(int)<http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#deleteDocument%28int%29>for information about when this deletion will become effective.
>
>
>
> From observation in my app, it is deleting documents that don't have the
> provided term, which means there's no easy way to delete a doc (other than
> iterating) even if you have a unique id.
>
> On 10/15/06, Otis Gospodnetic <otis_gospodnetic[at]yahoo.com> wrote:
> >
> > The javadoc is right. :)
> >
> > Otis
> >
> > ----- Original Message ----
> > From: EDMOND KEMOKAI <ekemokai[at]gmail.com>
> > To: java-user[at]lucene.apache.org
> > Sent: Sunday, October 15, 2006 12:49:21 AM
> > Subject: IndexReader.deleteDocuments
> >
> > Hi guys,
> > I am a newbee so excuse me if this is a repost. From the javadoc it
> > seems
> > Reader.deleteDocuments deletes only documents that have the provided
> > term,
> > but the implementation examples that I have seen and from the behaviour
> > of
> > my own app, deleteDocuments(term) deletes documents that don't have the
> > given term. Can someone clarify this for me?
> >
> > Thanks
> > Edmond Kemokai.
> >
> >
> > "talk trash and carry a small stick."
> > PAUL KRUGMAN (NYT)
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe[at]lucene.apache.org
> > For additional commands, e-mail: java-user-help[at]lucene.apache.org
> >
> >
>
>
> --
> "talk trash and carry a small stick."
> PAUL KRUGMAN (NYT)
>



--
* "Still searching for the gatekeeper to the Valence-Band, let me out of
here!"

* "When I was coming up, it was a dangerous world, and you knew exactly
who they were. It was us versus them, and it was clear who them was. Today,
we are not so sure who the they are, but we know they're there."

Poet Laureate G.W Bush (I am not a Bush basher by the way)

"talk trash and carry a small stick."
PAUL KRUGMAN (NYT)


yonik at apache

Oct 15, 2006, 9:18 PM

Post #5 of 5 (892 views)
Permalink
Re: IndexReader.deleteDocuments [In reply to]

On 10/16/06, EDMOND KEMOKAI <ekemokai[at]gmail.com> wrote:
> Can somebody please clarify the intended behaviour of
> IndexReader.deleteDocuments()?

It deletes documents containing the term. The API docs are correct,
the demo docs are incorrect if they say otherwise.

-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe[at]lucene.apache.org
For additional commands, e-mail: java-user-help[at]lucene.apache.org

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.