You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2010/01/20 15:40:41 UTC

[Solr Wiki] Update of "FilterQueryGuidance" by ShalinMangar

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "FilterQueryGuidance" page has been changed by ShalinMangar.
The comment on this change is: Fixed remarks on filter query and analysis.
http://wiki.apache.org/solr/FilterQueryGuidance?action=diff&rev1=8&rev2=9

--------------------------------------------------

  
  == Analysis, Scoring and Faceting ==
  
- Each field type in Solr can define a index-time and query-time analyzer. When a query is specified through the 'q' parameter, it is parsed and the token is analyzed through the query-time analyzer for that field's type. For example, 'string' type fields are not analyzed but 'text' type fields are analyzed. However, any query specified as a filter query through the 'fq' parameter is *not* analyzed regardless of the field's type. Therefore, filter queries are best suited for filtering on exact matches or range searches. If you need to filter but the search query needs to be analyzed, it should be specified through the 'q' parameter.
+ Each field type in Solr can define a index-time and query-time analyzer. When a query is specified through the 'q' parameter, it is parsed and the token is analyzed through the query-time analyzer for that field's type. For example, 'string' type fields are not analyzed but 'text' type fields are analyzed. Similarily, any query specified as a filter query through the 'fq' parameter is also analyzed in the same fashion. However, the results of a filter does not need to be ordered and hence it does not participate in the scoring. If you need to filter but the search query should affect the score too then it should be specified through the 'q' parameter.
  
+ Filter queries are great for filtering result sets based on facets. When drilling down into a facet value, the order of the results does not need to change and therefore facet values are a good candidate for filter queries.
- Filter queries, as the name suggest, are used for filtering (or drilling down) the result set. Therefore, the results of a filter does not need to be ordered and hence it does not participate in the scoring. Queries specified in the 'q' parameter contribute to the scores.
- 
- Filter queries are great for filtering result sets based on facets. Faceting is performed on the indexed tokens and therefore the value of any facet can be directly used in the 'fq' parameter since it does not need to be analyzed.
  
  == An example to illustrate the greater efficiency obtainable by filtering ==