lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Optimization
Date Wed, 05 Oct 2005 13:27:11 GMT

On Oct 5, 2005, at 9:05 AM, Aigner, Thomas wrote:
>     Have a question.. Is there any obvious things that can be done
> to help speed up query lookups especially wildcard searches (i.e.
> *lamps).

Obvious?  Sort of.  *lamps needs to scan through _every_ single term  
in the index (for the specified field only, of course) because terms  
are lexicographically ordered.

If you reverse terms during analysis and lay them in the same  
position (increment 0) as the original token you'd end up with  
"spmal..." terms.  Now pre-process the query string and if there is a  
prefixed wildcard query, reverse it so that "*lamps" turns into  
"spmal*" and you will likely achieve a dramatic speed-up.

This is just one technique for dealing with prefixed wildcard  
queries.  There is more fun to be had with queries like *lamps*.  A  
technique I learned from the book Managing Gigabytes is to rotate  
terms through all their possible variations and index all of those,  
which also requires cleverness on the querying side of things.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message