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 Joel Shellman <jo...@ikestrel.com> on 2004/07/12 16:21:38 UTC
IndexSearcher usage and caching?
I'm working on a document management system using lucene to search
through all the documents.
This means that I'll be adding/updating/deleting documents at the same
time searches are going on.
I thought to create an IndexSearcher and reuse it throughout, but that
doesn't seem to work. If I do a search, then add a document, and do
another search with the same IndexSearcher, it won't find the newly
added document.
I'd rather not have to create a new IndexSearcher for every query... do
I have to?
Thanks,
-joel shellman
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: IndexSearcher usage and caching?
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Cache/reuse your IndexSearcher.
On every search, check if the index has changed (there are methods for
that).
If it has changed, create a new IndexSearcher and assign it to your
IndexSearcher variable, and do not close the old IndexSearcher, just in
case something is still using it.
Otis
--- Joel Shellman <jo...@ikestrel.com> wrote:
> I'm working on a document management system using lucene to search
> through all the documents.
>
> This means that I'll be adding/updating/deleting documents at the
> same
> time searches are going on.
>
> I thought to create an IndexSearcher and reuse it throughout, but
> that
> doesn't seem to work. If I do a search, then add a document, and do
> another search with the same IndexSearcher, it won't find the newly
> added document.
>
> I'd rather not have to create a new IndexSearcher for every query...
> do
> I have to?
>
> Thanks,
>
> -joel shellman
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org