Solr 与空间的同义词
我的数据模型:
Dress
|-kind
|-color
|-for_season
我想搜索特定季节以及所有季节的模型,如下所示:
搜索查询:所有季节
应匹配:Winter、Spring、Summer、Fall
我的同义词文件中有以下行:
all\s seasons: Winter, Spring, Summer, Fall
我正在执行查询时间,我看到 solr 管理面板分析页面显示术语列中的同义词。但是,当我搜索 for_season:all seasons
时,我没有得到任何结果。
知道为什么吗?感谢您在这方面花费的时间。
编辑:
这是我的发现:
我必须转义出现在右侧的同义词,如下所示:
所有新闻 =>天气\预报、体育、...
在查询时,我必须将查询用双引号引起来。如下:
my_field:"所有新闻"
我必须将原始单词放在 RHS 上,因为除非重复它,否则它不会找到它。
新闻 =>新闻、天气预报、体育、...
现在看起来运行良好。感谢您抽出时间。
My data model:
Dress
|-kind
|-color
|-for_season
I want to search the model for a specific season as well as for all seasons, like as follows:
Search Query: all seasons
Should Match: Winter, Spring, Summer, Fall
I have the following line in my synonyms file:
all\s seasons: winter, spring, summer, fall
I am doing it query time and I see the solr admin panel analyze page showing the synonyms in the term column. However, when I search for for_season:all seasons
I don't get any result.
Any idea why? Appreciate your time on this.
Edit:
Here's what I found:
I had to escape the synonyms appearing on the right hand side, as follows:
all news => weather\ forecast, sports, ...
At query time, I had to wrap the query in double quotes. as follows:
my_field:"all news"
I had to put the original word on the RHS as it won't find that unless it was repeated.
news => news, weather\ forecast, sports, ...
It looks to be working fine now. Thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
空格不是同义词配置文件中的分隔符。你不应该逃避它。
根据此处的文档:
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
这应该只是
Space isn't a delimiter in the synonym configuration file. You shouldn't have to escape it.
Per documentation here:
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
This should just be
通常,Apache Solr 中存在多术语同义词(例如“所有季节”)的问题。您可以在这里找到此问题的描述:
在这里你可以找到这个问题的一个很好的解决方案:
https://lucidworks.com/blog/2014/07/12/solution-for-multi-term-synonyms-in-lucenesolr-using-the-auto-phrasing-tokenfilter/
Generally there is a problem with multi-term synonyms (e.g. 'all seasons') in Apache Solr. Description of this problem you can find here:
and here you can find a nice solution of this problem:
https://lucidworks.com/blog/2014/07/12/solution-for-multi-term-synonyms-in-lucenesolr-using-the-auto-phrasing-tokenfilter/