*If* your terms are simple (that is, not wildcarded), you may get some joy from TermEnum. The idea here would be to find the longest term *already in your index* that satisfies your need and use that to form a simple TermQuery....
Essentially using TernEnum.skipTo on successively shorter strings until it returned true... Best Erick On Tue, Apr 21, 2009 at 4:57 PM, Artyom Sokolov <unn...@gmail.com> wrote: > Hello. > > Currently I'm trying to find something like an analyzer to solve the > problem. > > Actually, what I need is next: search on a query string step-by-step, > trimming last char on each step. Small example: > > In index we've: abc, abcdef, xyz > When search on abcdefgh the most relevant result should be abcdef, while > searching on abcde the best one is abc. > > Thanks. > > Sincerely, > Artyom Sokolov >