SOLR 过滤查询与主查询 [英] SOLR filter-query vs main-query

查看:26
本文介绍了SOLR 过滤查询与主查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SOLR 文档,声明过滤查询,不同于ma​​in查询,不影响文档分数.谁能解释一下这到底是什么意思,最好举个例子.

SOLR docs, state that filter queries, unlike the main query, do not influence the document score. Can anyone explain what does this mean exactly, preferably with an example.

谢谢.

推荐答案

FilterQuery 仅存储文档 IDS.这使得应用过滤器来包含/排除文档变得非常快.一个很好的例子是根据国家/地区、产品类型、可用性等从搜索中过滤产品.

A FilterQuery ONLY stores document IDS. This makes it very fast to apply the filter to include/exclude documents. Good examples of this are when filtering products from search based on Country, Product Type, Availability, etc.

普通查询可以执行完全相同的功能,但它有一个非常复杂的评分系统来确定相关性".我相信文档表明评分仅在主查询上完成,而不是在过滤查询上完成.这也应该会提高查询速度.

A normal query can perform the exact same function, but it has a very complex scoring system to determine "relevance". I believe the documentation is indicating that scoring is only done on the Main Query, not on the Filter Query. This should also increase query speed.

所以,我可以查询:

description:Kohler AND productType:Toilet

或者我可以查询:

description:Kohler
with a FQ of productType:Toilet

结果相同,但分数不同.此外,如果您在一天中收到许多针对 productType:Toilet 的不同查询,FilterQuery 将被缓存,从而加快整体查询时间.

The results would be the same, but the scores would be different. Also, if you get many different queries throughout the day that are for productType:Toilet, the FilterQuery would be cached making the overall query time faster.

这篇关于SOLR 过滤查询与主查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆