lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan McKinley <ryan...@gmail.com>
Subject Re: boosting results by a query?
Date Tue, 15 Feb 2011 02:47:14 GMT
found something that works great!

in 3.1+ we can sort by a function query, so:

&sort=query({!lucene v='field:value'}) desc, score desc

will put everything that matches 'field:value' first, then order the
rest by score

check:
http://wiki.apache.org/solr/FunctionQuery#Sort_By_Function




On Fri, Feb 11, 2011 at 4:31 PM, Ryan McKinley <ryantxu@gmail.com> wrote:
> I have an odd need, and want to make sure I am not reinventing a wheel...
>
> Similar to the QueryElevationComponent, I need to be able to move
> documents to the top of a list that match a given query.
>
> If there were no sort, then this could be implemented easily with
> BooleanQuery (i think) but with sort it gets more complicated.  Seems
> like I need:
>
>  sortSpec.setSort( new Sort( new SortField[] {
>    new SortField( something that only sorts results in the boost query ),
>    new SortField( the regular sort )
>  }));
>
> Is there an existing FieldComparator I should look at?  Any other
> pointers/ideas?
>
> Thanks
> ryan
>

Mime
View raw message