简体   繁体   English

Solr Facet字段和过滤器查询之间的区别

[英]Difference between Solr Facet Fields and Filter Queries

I am using SolrMeter to test Apache Solr search engine. 我正在使用SolrMeter来测试Apache Solr搜索引擎。 The difference between Facet fields and Filter queries is not clear to me. Facet字段和Filter查询之间的区别对我来说并不清楚。 SolrMeter tutorial lists this as an exapmle of Facet fields : SolrMeter教程将此列为Facet字段的一个例子:

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? 我可以在不指定构面或滤镜的情况下使用SolrMeter吗?

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." 例如,如果您有10个产品与“软地毯”的查询相匹配,如果您面对“原产地”,则可能会获得6个“Oklahoma”文档和4个“Texas”文档。 The facet field query will give you the numbers 6 and 4. 构面字段查询将为您提供数字6和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. 例如,您可以搜索索引以查找产品,但您只想返回受地理区域或其他内容约束的结果。

A facet is an field (type) of the document, so category is the field. facet是文档的字段(类型),因此category是字段。 As Ansari said, facets are used to get statistics and provide grouping capabilities. 正如安萨里所说,facet用于获取统计数据并提供分组功能。 You could apply grouping on the category field to show everything vegetable as one group. 您可以在category字段上应用分组,以将所有vegetable显示为一个组。

Edit: The parts about searching inside of a specific field are wrong. 编辑:有关在特定字段内搜索的部分是错误的。 It will not search inside of the field only. 它不会仅在字段内搜索。 It should be 'adding a constraint to the search' instead. 它应该是“为搜索添加约束”。

Performing a filter query of category:vegetable will search for vegetable in the category field and no other fields of the document. 执行category:vegetable的过滤查询将在category字段中搜索vegetable ,而不搜索文档的其他字段。 It is used to search just specific fields rather than every field. 它仅用于搜索特定字段而不是每个字段。 Sometimes you know that the term you want only is in one field so you can search just that one field. 有时您知道您想要的术语只在一个字段中,因此您只能搜索该字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM