Hello.

I am trying to implement a search based on a search text in an index that
contains Track Title, Album Name or Artist Name information that delivers a
list or results that are suited for "auto completion" to make searching
easier for the user. This search is very performance critical. The real
search itself is done on a seperate index and has already been implemented.

Results should match any Title or Name that contains the sepecified text,
however only only matching at the start of a word. The PrefixQuery is
predestined for this, I think.
I created the index using a WhitespaceAnalyzer.

So for instance if I search for "Sing I"
it should match the texts
"If I Don't Sing I'll Cry", "Sing It" and "Sing It Again",
but not "I Sing".

The current solution I've come up with until now is use a
WhitespaceTokenizer
and create a TermQuery for all but the last token and a PrefixQuery for the
last token,
and combine this with AND (Occur.MUST).
So for instance "I Sing" would result in "item.name:Sing AND item.name:I*"
(I think,
I've never seen the string representation of the query).

When retrieving the results I check if the original query text is contained
within the returned item.name (while ignoring cases), and only return it if
it is
the case.

I am not sure however if this is a good result, performance-wise.
Can you provide a better solution and/or comment on my current one.

The currend one is quite quick if no whitespace is contained in the search
term,
but requests are many times slower if there are whitespaces (usually normal
spaces)
in the search term.

Thanx,
Lukas
-- 
View this message in context: 
http://www.nabble.com/Auto-Completion-search-tp18071627p18071627.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to