SOLR - PathHierarchyTokenizerFactory Facet 查询
我一直在尝试对配置为 solr.PathHierarchyTokenizerFactory 的字段执行查询,但查询仅返回所有记录。看来进行方面查询是行不通的。有没有人有办法实现这个?我正在使用 PathHierarchy 来实现类别/子类别方面。
<fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
</analyzer>
</fieldType>
<field name="libraries" type="text_path" indexed="true" stored="true" multiValued="true" />
和
http://linux2:8984/solr/select?q=*:*&rows=0&fq=libraries:"/test/subtest"&facet=true&facet.field=libraries&f .libraries.facet.sort=true&f.libraries.facet.limit=-1&f.libraries.facet.mincount=-1
谢谢
I have been trying to perform a query on a field that is configured to be solr.PathHierarchyTokenizerFactory, but the query just returns all records. It seems that doing a facet query is just not working. Does anyone have a way of accomplishing this? I'm using the PathHierarchy to implement category/subcategory facets.
<fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
</analyzer>
</fieldType>
<field name="libraries" type="text_path" indexed="true" stored="true" multiValued="true" />
And
http://linux2:8984/solr/select?q=*:*&rows=0&fq=libraries:"/test/subtest"&facet=true&facet.field=libraries&f.libraries.facet.sort=true&f.libraries.facet.limit=-1&f.libraries.facet.mincount=-1
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更改您的 text_path 字段定义以仅在索引时应用 PathHierarchyTokenizerFactory (下面的示例)。您的问题是您的查询正在由标记生成器处理,以便 fq=libraries:"/test/subtest" 实际上针对 fq=libraries:(/test/subtest OR /test) 进行查询。
注意分析器类型=“索引”
Change your text_path field definition to apply the PathHierarchyTokenizerFactory at index time only (example below). Your issue is that your queries are being processed by the tokenizer so that fq=libraries:"/test/subtest" actually queries against fq=libraries:(/test/subtest OR /test).
Note the analyzer type="Index"
如果删除分面参数会发生什么?它也返回所有文件吗?
从我看来,分面不应该对搜索结果产生影响。在我看来,您在 fq 参数中传递的过滤器查询由于某种原因不起作用。
What happens if you remove the faceting parameters? Does it return all documents also?
From my opinion faceting should not have an effect on the search results. It seems to me that the filter query you passed in the fq parameter is not working for some reason.