Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between q and fq in Solr

Tags:

Someone please give me a decent explanation of the difference between q and fq in Solr query, covering some points such as -

  • Do they have the same syntax?
  • Do they return same results?
  • When to use which one and why?
  • Any other differences
like image 603
Mawia Avatar asked Jan 08 '14 06:01

Mawia


People also ask

What is Q and FQ?

Standard solr queries use the "q" parameter in a request. Filter queries use the "fq" parameter. The primary difference is that filtered queries do not affect relevance scores; the query functions purely as a filter (docset intersection, essentially). Follow this answer to receive notifications.

What does FQ mean in Solr?

The fq (Filter Query) Parameter The fq parameter defines a query that can be used to restrict the superset of documents that can be returned, without influencing score. It can be very useful for speeding up complex queries, since the queries specified with fq are cached independently of the main query.

What is Q in Solr query?

Solr provides Query (q parameter) and Filter Query (fq parameter) for searching. The query (q parameter), as the name suggests, is the main query used for searching. Example. q = title:james. Filter queries are used alongside query (q parameter) to limit results of queries using additional filters.

How do you write FQ in Solr?

In the lucid works SOLR training they suggested you do multiple fq parameters instead of a single one joined with AND for performance reasons. So in the sample it would be q=*:*&fq=(catid:90 OR catid:81)&fq=priceEng:[38 TO 40]&fq=.... etc.


1 Answers

Standard solr queries use the "q" parameter in a request. Filter queries use the "fq" parameter.

The primary difference is that filtered queries do not affect relevance scores; the query functions purely as a filter (docset intersection, essentially).

like image 75
jro Avatar answered Oct 02 '22 11:10

jro