On 16.06.2008, at 13:08, Max W. wrote:
I have searched the Ferret API but I can’t find a way to do for
Show all words in index that start with ‘s’, then ‘sp’, then ‘spa’,
This might be accomplished by using a TermEnum
) which basically is a list of all terms present in the index in a
given field. Using term_enum.skip_to(‘s’) should bring back the first
term starting with letter ‘s’, then get all other terms with s by
calling term_enum.next as often as necessary.
Never tried this, but it should work.
However the ‘common’ way for autocomplete is indeed to base the
completion on past searches, i.e. index user’s successful queries and
suggest matching past queries while the user is typing.
If that’s really not what you want, you could also build up a second
index containing all the terms that occur in your data, each as a
document on its own (like your own dictionary), and get suggestions
from there, with fuzzy queries if you like. This can also be used for
‘did you mean’ stuff in case the user has a typo in his query and got
no results because of that.
Finkenlust 14, 06449 Aschersleben, Germany
VAT Id DE251962952
http://www.jkraemer.net/ - Blog
http://www.omdb.org/ - The new free film database