lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Steiger <msli...@infoworks.at>
Subject Re: Best Practices for indexing in Web application
Date Tue, 02 Mar 2004 22:07:16 GMT
Morus Walter wrote:

> Michael Steiger writes:
> 
>>Hello Lucene Users,
>>I have a web application using Oracle as the database and I want to add 
>>fulltext query capablities. My idea was to extend the existing insert, 
>>update and delete methods of my backend classes to add, delete/add and 
>>delete respectively.
>>
>>I'm new to Lucene and after a bit of googling and reading I found a few 
>>issues which I do not know how to resolve in the moment.
>>
>>1. Concurrency of IndexWriter and IndexReader
>>It seems that it is not allowed to open an IndexWriter and an 
>>IndexReader at the same time. But if one user is changing records in the 
>>database (and therefore changing documents in the Lucene index) and 
>>another user is querying the index, I would need to open them both.
>>
> 
> No.
> You can have one IndexWriter and an arbitray number of IndexReaders, that
> don't write to the index.
> Despite it's name IndexReader is used for deletions. Since this is a write
> operation, it cannot be done, while a IndexWrite is open.
> But that's the only limitation.

OK, misunderstanding found. I already know that IndexReader is mostly 
used for deletions but I thought that I can not have Reader and Writer 
objects open at the same time. I now understand that I can have multiple 
Readers but the delete operations must be synchronized with open Writers.


> IndexReaders will not see changes introduced by writers until they are
> closed and reopened. And one should be aware that keeping the Readers open
> after changes means that the associated files are kept open, which may result
> in too many open files.

OK. I only wanted to open a Reader for deletions and close it 
afterwards. So this should be no problem.


>>2. Optimizing the index
>>This is maybe related to my first issue.
>>I assume that while optimizing the index no queries are allowed. How 
>>often should the index be optimized?
>>
> 
> AFAIK there's no problem with searching during optimizing of an index.
> 
> IIRC the FAQ says, that optimizing should only be done, if you know, that
> your index won't change for some time.
> As far as I understand lucenes indexing, the reason is, that lucene will
> automatically merge the index files (based on MergeFactor), which is, 
> what optimizing does.

My problem is that I do not know in advance if or when the "index won't 
change for some time". I think of running a counter for all updates 
(add, delete) and optimize after some threshold.

Thanks for your help
Michael

---------------------------------------------------------------------
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