Solr Cheat Sheet

This is a very small list of useful Solr URL parameters. It’s mostly for the benefit of the project group, but you might find it useful too!

q : q=* or q=*:*
The basic query parameter. In this field you can put your full Solr query. If you are using the dismax query type (see below) then you can only put freetext searches in here (like q=whatever), otherwise you can construct full Lucene queries (like q=author:richard). If you are using the dismax query type, use q.alt for full Lucene power instead.
q.alt : q.alt=*:*
For use with the dismax query type, this allows you to do a full Lucene query
fl : fl=title,author,score
Field List. The list of fields to be returned in the result set. In addition to those fields in the Solr schema you can also specify score which will give you the relevance rank that Lucene allocated the result document
sort : sort=title asc
Sort field and direction. Specify a field followed by a space followed by the direction (desc/asc). You can also specify multiple sort fields, and present them here in the order that you want to sort them by; so sort=title asc,author desc and so on.
defType : defType=dismax
Specify the query type. In particular, the dismax is very useful for freetext searches. See for details. When using dismax the q parameters will only work for freetext searching, and q.alt should be used for full Lucene query power.
facet : facet=on
Turn facets on or off. If on, then the fields specified by the facet.field parameters will be returned
facet.field : facet.field=author
Return along with the result set a facet count for the author field. This will only have an effect if facet=on is also specified. You can specify multiple facet.field parameters as separate URL arguments: facet.field=author&facet.field=year&facet.field=subject

Obviously the full list of URL parameters for Solr is much larger, and we’ll add to this cheat sheet the parameters which we think are the most useful as we go through the project.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: