Solr / Lucene: What is the difference between regular queries and filters?

I am currently implementing a Solr solution in which the user can select various product search options. Now I can take all these parameters and combine them into one long query, or I can use a query that retrieves everything (*: *) and applies query filters to it.

Normal query:

q=color:blue AND price:500 

A query using filter queries:

 q=*:*&fq=color:blue&fq=price:500 

The result is exactly the same. So what is the difference? When should I use one or the other?

+4
source share
2 answers

Filtering queries do not affect the number of documents. Further, they are useful in caching, requests specified using fq are cached regardless of the main request. Document for solr request parameters

+4
source

Typically, on any production system, you should use the Dismax request handler Dismax , which does not support the previous syntax, so filtering should be performed using filter requests in this case.

0
source

Source: https://habr.com/ru/post/1369130/


All Articles