lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Lucene-java Wiki] Update of "LuceneFAQ" by MikeMcCandless
Date Sun, 10 Jun 2007 09:34:19 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Lucene-java Wiki" for change notification.

The following page has been changed by MikeMcCandless:

  Just re-execute the search and ignore the hits you don't want to show. As people usually
look only at the first results this approach is usually fast enough.
- ==== The search is slow when there are many hits. ====
- Iterating over all hits is slow for two reasons. Firstly, the search() method that returns
a Hits object re-executes the search internally when you need more than 100 hits. Solution:
use the search method that takes a !HitCollector instead. Secondly, the hits will probably
be spread over the disk so accessing them all requires much I/O activity. This cannot easily
be avoided unless the index is small enough to be loaded into RAM. If you don't need the complete
documents but only one (small) field you could also use the !FieldCache class to cache that
one field and have fast access to it.
  ==== How do I speed up searching? ====
  See ImproveSearchingSpeed.
-   * Don't iterate over more hits than needed (see question above).
-   * Do not re-open the !IndexReader/!IndexSearcher more often than necessary. In other words,
open them once and then make many searches. Re-opening the !IndexReader has a certain overhead
(noticeable mostly with large indexes and with sorting turned on) and should thus be avoided.
Also take this overhead into account when making performance tests (i.e. don't measure the
first searches).
-   * [
Optimize] your index.
  ==== Why do I sometimes get a FileNotFoundException when I search and update my index at
the same time? ====

View raw message