O'Reilly logo

Apache Solr 3 Enterprise Search Server by Eric Pugh, David Smiley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sorting

The sorting specification is specified with the sort query parameter. The default is score desc. score is not a field but a special reference to a relevancy number, described in detail in the next chapter. desc means descending order, use asc for ascending order. In the following example, suppose we searched for artists that are not individuals (a previous example in the chapter), and then we might want to ensure that those that are surely bands, get top placement ahead of those that are unknown. Secondly, we want the typical descending score search. This would simply be:

sort=a_type desc,score desc

Note

Pay attention to the field types and text analysis you're using in your schema for fields that you sort on. Basically, fields need to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required