Solr/Lucene: What is the difference between regular queries and filter queries
I'm currently implementing a Solr solution where a user is able to select various options to search for a product. I can now take all those options and put them together into one single long query, or I can use a query that fetches开发者_开发技巧 everything (*:*) and applies query filters to it.
Regular query:
q=color:blue AND price:500
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?
Filter queries do not influence scores of the document. Further they are useful in Caching, the queries specified with fq are cached independently from the main query Document for solr query parameters
Typically in any production system you would use a variant of the Dismax
request handler which doesn't support the former syntax, hence filtering must be performed using filter queries in that case.
精彩评论