In this case, we're storing the overall value length and sorting it on that, then alphabetically.
Also, how are your queries fashioned? If you're doing a prefix query, everything that matches it should score the same. If you're only doing a prefix query, you might need to add a term for exact matches as well to get them to show up. Michael Della Bitta ------------------------------------------------ Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017 www.appinions.com Where Influence Isn’t a Game On Wed, Aug 1, 2012 at 9:58 PM, Lochschmied, Alexander <alexander.lochschm...@vishay.com> wrote: > Is there a way to offer distinct, alphabetically sorted, fixed length options? > > I am trying to suggest part numbers and I'm currently trying to do it with > the spellchecker component. > Let's say "ABCD" was entered and we have indexed part numbers like > ABCD00000000 > ABCD20000000 > ABCD21000000 > ABCD22000000 > ... > > I would like to have 2 characters suggested always, so for "ABCD", it should > suggest > ABCD00 > ABCD20 > ABCD21 > ABCD22 > ... > > No smart sorting is needed, just alphabetically sorting. The problem is that > for example 00 (or ABCD00) may not be suggested currently as it doesn't score > high enough. But we are really trying to get all distinct values starting > from the smallest (up to a certain number of suggestions). > > I was looking already at custom comparator class option. But this would > probably not work as I would need more information to implement it there > (like at least the currently entered search term, "ABCD" in the example). > > Thanks, > Alexander