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

Filtering

Separate from the q parameter (that is the user query), you can specify additional so-called filter queries that will filter the search results. Arguably the user query is also a filter but you instead see the word "search" used for that. Filter queries don't affect scoring, unlike the user query. To add a filter, simply use the fq parameter. This parameter can be added multiple times for additional filters. A document must match all filter queries and the user query for it to be in the results.

As an example, let's say we wanted to make a search form for MusicBrainz that lets the user search for bands, not individual artists, and those that released an album in the last 10 years. Let's also say that the user's query string is Green ...

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