You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by tierecke <ni...@gmail.com> on 2007/08/06 14:50:30 UTC

indexing and searching in the same time

Does Lucene allow searching and indexing simultaneously?

Yes. However, an IndexReader only searches the index as of the "point in
time" that it was opened. Any updates to the index, either added or deleted
documents, will not be visible until the IndexReader is re-opened. So your
application must periodically re-open its IndexReaders to see the latest
updates. The [WWW] IndexReader.isCurrent() method allows you to test whether
any updates have occurred to the index since your IndexReader was opened. 

[from Lucene FAQ]

Still I need to speed this process.


Thanks Daniel, you are completely right.
I changed the code - but it doesn't make it [noticeably faster] - probably
behind the scene it does run on the enum.
I added some kind of hash table that keeps the docfreq already read so if I
meet it again in another document I can retrieve it quickly - is there
another solution? Maybe have a separate Lucene index for this? (In this case
- can I read and write to the same index without closing it and reopening
it? I want to read from it and if I don't find the docfreq there, calculate
it and put it in the index).

10x Nir.


Daniel Naber-10 wrote:
> 
> On Monday 06 August 2007 01:40, tierecke wrote:
> 
>>         Term term=new Term("contents", termstr);
>>         TermEnum termenum=multireader.terms(term);
>>         int freq=termenum.docFreq();
> 
> IndexReader has a docFreq() method, no need to get a Term enumeration.
> 
> regards
>  Daniel
> 
> 

-- 
View this message in context: http://www.nabble.com/docFreq-takes-long-time-to-execute-in-a-multiple-index-environment-tf4221604.html#a12015687
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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