17 jan 2008 kl. 16.42 skrev Cam Bazz:
Hello,
Hi,
I understand after writing some documents in an index with an
indexwriter,
the IndexSearcher object has to be reinstantiated for it to find newly
instantiated objects.
that is correct, given you instantiate the new IndexSearcher(directory);
And this reinstantiation of IndexSearcher is costly from what I
understand.
It is not so much the construction of the instance as it is the inital
latency in response time for a query on this searcher.
Have you read this on the Wiki?
<http://wiki.apache.org/lucene-java/ImproveSearchingSpeed>
* '''Re-open the [http://lucene.apache.org/java/docs/api/org/apache/lucene/search/IndexSearcher.html
IndexSearcher] only when necessary.'''
You must re-open the [http://lucene.apache.org/java/docs/api/org/apache/lucene/search/IndexSearcher.html
IndexSearcher] in order to make newly committed changes visible to
searching. However, re-opening the searcher has a certain overhead
(noticeable mostly with large indexes and with sorting turned on)
and should thus be minimized.
Consider using a so called [http://wiki.apache.org/solr/SolrCaching
warming] technique which allows the searcher to warm up its caches
before the first query hits.
Basically you execute a bunch of queries on the new searcher before
you make the switch with the old one.
Will this solve your performance issues?
If not, please explain what it is you try to cache (is it the search
results?), how your writer/searcher code works and preferably with
some performance benchmarks that show your problems.
--
karl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]