lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: AutoSuggest with custom sorting
Date Tue, 04 May 2010 21:30:26 GMT

First off: i would suggest that instead of doing a simple prefix search, 
you look into using EdgeNGrams for this sort of thing.

I'm also assuming since you need custom scoring for this, you aren't going 
to get what you need using the TermsComponent or any other simple solution 
using your main corpus -- it would make more sense to setup a special 
index consisting of one document per "term" to include in your 

: > 1. Results matching field1 should be ranked higher. Results matching the

easily done with dismax .. even if you are using EdgeNGrams (just make 
sure you have EdgeNGrams on at index time, but not at query time)

: > 2.The next sort parameter is the length of the word. So, if you are
: > searching for IR, Row2 (2 out of 4 ) matches higher than Row3 (2 out of 5).

this can be accomplished by indexing a numeric field containing the 
"length" of the field as a number, and then doing a secondary sort on it.  
the fieldNorm typically takes care of this sort of thing for you, but is 
more of a generalized concept, and doesn't give you exact precision for 
small numbers.


View raw message