简体   繁体   English

Solr 中过滤器查询的 docValues 与索引字段类型

[英]docValues Vs indexed field types for filter queries in Solr

I need to add a field to Solr that would only be used for filtering.我需要向 Solr 添加一个仅用于过滤的字段。

ie /query?q=*&fq=department:HR/query?q=*&fq=department:HR

Which of these two definitions would work better and why?这两个定义中哪一个会更好,为什么?

<field name="department" type="string" indexed="true" docValues="false" />
<field name="department" type="string" indexed="false" docValues="true" />

The below implementation is good for querying:以下实现适用于查询:

<field name="department" type="string" indexed="true" docValues="false" />

Reason:原因:

docValues="true" is required when you want to do faceting and sorting . docValues="true" 当你想要做 faceting 和 sort 时是必需的 It will be the ideal and optimized case in that situation.在这种情况下,这将是理想和优化的案例。 Since you only want querying docValues="false" is good.由于您只想查询 docValues="false" 很好。

indexed="true" is good and it will query your results faster as it will store the field in the indexed form which is faster than normal field . indexed="true"很好,它会更快地查询您的结果,因为它将字段存储在比普通字段更快的索引形式中 So you'll be able to retrieve the results faster.因此,您将能够更快地检索结果。

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

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