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
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
but requests are many times slower if there are whitespaces (usually normal
in the search term.

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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupjava-user @
postedJun 23, '08 at 3:25p
activeJun 23, '08 at 4:19p



site design / logo © 2022 Grokbase