lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: docfaq of IndexReader is showing the deleted document also
Date Wed, 28 Jul 2004 09:41:23 GMT
Moved to the more appropriate lucene-user list.

Why don't you just use IndexSearcher with TermQuery with new
Term("OID","9365") ?

The search with such TermQuery will get you 1 or 0 hits, assuming OID
acts as a primary key.  1 if OID=9365 has not been deleted, 0
otherwise.

Otis

--- lingaraju <lingaraju.shambulingaiah@infactindia.com> wrote:

> 
> Thanks for information
> I have read the documentation for the IndexReader.delete. method
> After "Indexwriter optimize()" method "docFreq" is giving correct
> count I
> mean excluding deleted document
> I am having one more question
> Actually I am using docFreq method to find the particular document is
> present or not in index by using key(Unique) field OID
> 
>   IndexReader reader = IndexReader.open("c:/index");
>   Term term = new Term("OID","9365");
>   int i=reader.docFreq(term);
>   if (i!=0)
>   {System.out.println("Document present the index:"+i); }
> 
> This is the right way or is there any way to find out?
> 
> Regards
> Raju
> 
> 
> 
> ----- Original Message ----- 
> From: "Bernhard Messer" <Bernhard.Messer@intrafind.de>
> To: "Lucene Developers List" <lucene-dev@jakarta.apache.org>
> Sent: Tuesday, July 27, 2004 7:28 PM
> Subject: Re: docfaq of IndexReader is showing the deleted document
> also
> 
> 
> > Hi Raju,
> >
> > read the documentation for the IndexReader.delete method and you
> will
> > find your way ;-)
> >
> > /** Deletes the document numbered <code>docNum</code>.  Once a
> document is
> >    deleted it will not appear in TermDocs or TermPostitions
> enumerations.
> >    Attempts to read its field with the {@link #document}
> >    method will result in an error.  The presence of this document
> may
> > still be
> >    reflected in the {@link #docFreq} statistic, though
> >    this will be corrected eventually as the index is further
> modified.
> >    */
> >
> > public final synchronized void delete(int docNum) throws
> IOException
> >
> >
> > regards
> > Bernhard
> >
> > lingaraju wrote:
> >
> > >I used the below code
> > >
> > >reader.delete(term);
> > >i=reader.docFreq(term);
> > >System.out.println("docfaq:"+i);
> > >reader.close();
> > >
> > >reader.docFreq method is returning 10 count before delete even
> after
> delete
> > >also count is showing same why
> > >
> > >Regards
> > >Raju
> > >
> > >
> > >
> >
>
>---------------------------------------------------------------------
> > >To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> > >For additional commands, e-mail:
> lucene-dev-help@jakarta.apache.org
> > >
> > >
> > >
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message