Wojtek, I believe http://lucene.apache.org/java/2_4_1/api/core/org/apache/lucene/search/spans/SpanFirstQuery.html would help, though there is no support for Span queries in Solr. But there is support for custom query parsers, and there is http://lucene.apache.org/java/2_4_1/api/contrib-snowball/index.html
Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch ----- Original Message ---- > From: wojtekpia <wojte...@hotmail.com> > To: solr-user@lucene.apache.org > Sent: Thursday, May 7, 2009 2:41:29 PM > Subject: Sorting by 'starts with' > > > I have an index of product names. I'd like to sort results so that entries > starting with the user query come first. > E.g. > > q=kitchen > > Results would sort something like: > 1. kitchen appliance > 2. kitchenaid dishwasher > 3. fridge for kitchen > > It looks like using a query Function Query comes close, but I don't know how > to write a subquery that only matches if the value starts with the query > string. > > Has anyone solved a similar need? > > Thanks, > > Wojtek > -- > View this message in context: > http://www.nabble.com/Sorting-by-%27starts-with%27-tp23432815p23432815.html > Sent from the Solr - User mailing list archive at Nabble.com.