Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Solr Facet Fields and Filter Queries

I am using SolrMeter to test Apache Solr search engine. The difference between Facet fields and Filter queries is not clear to me. SolrMeter tutorial lists this as an exapmle of Facet fields :

content
category
fileExtension

and this as an example of Filter queries :

category:animal

category:vegetable
categoty:vegetable price:[0 TO 10] 
categoty:vegetable price:[10 TO *] 

I am having a hard time wrapping my head around it. Could somebody explain by example? Can I use SolrMeter without specifying either facets or filters?

like image 427
user1411110 Avatar asked Jul 13 '12 19:07

user1411110


People also ask

What is the difference between filter and facet?

Filter means anything that analyzes a set of content and excludes some items. Faceted navigation is composed of multiple filters that comprehensively describe a set of content. For example, imagine searching for a healthy recipe for green enchiladas.

What is facet field in SOLR?

Faceting is the arrangement of search results into categories based on indexed terms. Searchers are presented with the indexed terms, along with numerical counts of how many matching documents were found were each term.

What is filter query in SOLR?

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.

What are facet fields?

Faceted fields are an important part of Insight. Simply explained, a facet is a field with an index built on it, and that index contains the unique values of the field. Just by looking at the values in a field with a facet, you can immediately see how many records have that value.


1 Answers

Facet fields are used to get statistics about the returned documents - specifically, for each value of that field, how many returned documents have that value for that field. So for example, if you have 10 products matching a query for "soft rug" if you facet on "origin," you might get 6 documents for "Oklahoma" and 4 for "Texas." The facet field query will give you the numbers 6 and 4.

Filter queries on the other hand are used to filter the returned results by adding another constraint. The thing to remember is that the query when used in filtering results doesn't affect the scoring or relevancy of the documents. So for example, you might search your index for a product, but you only want to return results constrained by a geographic area or something.

like image 189
Ansari Avatar answered Sep 22 '22 15:09

Ansari