solr - 自动建议器中的 Solr 服务器上下文过滤不起作用
问题描述
当我尝试将上下文过滤与自动建议器一起使用时遇到问题。我想要的是根据url 字段过滤建议
这是我的搜索组件:
<lst name="suggester">
<str name="name">AnalyzingInfixSuggester</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">main_title</str>
<str name="weightField">main_title</str>
<str name="contextField">url</str>
<str name="suggestAnalyzerFieldType">text_general</str>
</lst>
以下是我的架构中的字段:
<field name="main_title" type="string" indexed="true" stored="true"/>
<field name="url" type="string" indexed="true" stored="true"/>
示例:我正在搜索“aacsb”并且我有两个结果,这是正确的。一份是英文的,一份是德文的。我想过滤掉它们,只显示德语结果。
我的网址如下所示:
https://www.myWebsite.com/aacsb-dog-lion?german
https://www.myWebsite.com/aacsb-dog-lion?english
这是我的查询:
http://localhost:8983/solr/myCore/suggest?&q=aacsb&suggest.dictionary=AnalyzingInfixSuggester&suggest.cfq=-url:english
http://localhost:8983/solr/myCore/suggest?&q=aacsb&suggest.dictionary=AnalyzingInfixSuggester&suggest.cfq=-english
有了这些,我收到了两个结果。我们是否有字段名称并不重要。
当我尝试这些
http://localhost:8983/solr/myCore/suggest?&q=aacsb&suggest.dictionary=AnalyzingInfixSuggester&suggest.cfq=url:english
http://localhost:8983/solr/myCore/suggest?&q=aacsb&suggest.dictionary=AnalyzingInfixSuggester&suggest.cfq=english
我没有收到任何结果。
我多次阅读文档:LINK,但我仍然无法使其工作。
欢迎任何帮助。
谢谢!
编辑:我粘贴了错误的查询,这是正确的:
http://localhost:8983/solr/myCore/suggest?&q=aacsb&suggest.dictionary=AnalyzingInfixSuggester&suggest.cfq=url:\*english\*
http://localhost:8983/solr/myCore/suggest?&q=aacsb&suggest.dictionary=AnalyzingInfixSuggester&suggest.cfq=\*english\*
解决方案
推荐阅读
- python - 如果满足条件,如何仅在列表中调用字典值?
- shared-memory - shm_open 函数的正确 Java 映射是什么?
- ember.js - 渲染表单时出现 ember-bootstrap 错误
- r - 如何修复“HTTP状态为'409 Conflict'文件中的错误(con,“r”)”
- python - Selenium PhantomJS 和 Chrome 驱动程序在特定 URL 上返回空白页
- python - 由于张量未初始化而导致的错误
- c - 如何在 C 中撤消井字游戏中的多个步骤
- arrays - 无法循环遍历 laravel 集合数组
- sql - Pivot SQL - 标头包含 DISTINCT 和 DatePart(数据转换)字段
- html - 如何使文本框彼此居中对齐?