SOLR - PathHierarchyTokenizerFactory Facet 查询

发布于 2024-11-28 02:56:40 字数 749 浏览 1 评论 0原文

我一直在尝试对配置为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清风疏影 2024-12-05 02:56:40

更改您的 text_path 字段定义以仅在索引时应用 PathHierarchyTokenizerFactory (下面的示例)。您的问题是您的查询正在由标记生成器处理,以便 fq=libraries:"/test/subtest" 实际上针对 fq=libraries:(/test/subtest OR /test) 进行查询。

<fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
    </analyzer>
</fieldType>

注意分析器类型=“索引”

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).

<fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
    </analyzer>
</fieldType>

Note the analyzer type="Index"

只是一片海 2024-12-05 02:56:40

如果删除分面参数会发生什么?它也返回所有文件吗?

从我看来,分面不应该对搜索结果产生影响。在我看来,您在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文