You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2007/11/24 18:27:29 UTC

[Lucene-java Wiki] Update of "ImproveSearchingSpeed" by MarkHarwood

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 MarkHarwood:
http://wiki.apache.org/lucene-java/ImproveSearchingSpeed

------------------------------------------------------------------------------
  
   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.
  
+  * '''When using fuzzy queries use a minimum prefix length.'''
+ 
+  Fuzzy queries perform CPU-intensive string comparisons - avoid comparing all unique terms with the user input by only examining terms starting with the first "N" characters. This prefix length is a property on both QueryParser and FuzzyQuery - default is zero so ALL terms are compared. 
+