Solr 与空间的同义词

发布于 2024-12-27 20:14:46 字数 764 浏览 2 评论 0原文

我的数据模型:

Dress
|-kind
|-color
|-for_season

我想搜索特定季节以及所有季节的模型,如下所示:

搜索查询:所有季节

应匹配:Winter、Spring、Summer、Fall

我的同义词文件中有以下行:

all\s seasons: Winter, Spring, Summer, Fall

我正在执行查询时间,我看到 solr 管理面板分析页面显示术语列中的同义词。但是,当我搜索 for_season:all seasons 时,我没有得到任何结果。

知道为什么吗?感谢您在这方面花费的时间。

编辑:

这是我的发现:

  1. 我必须转义出现在右侧的同义词,如下所示:

    所有新闻 =>天气\预报、体育、...
    
  2. 在查询时,我必须将查询用双引号引起来。如下:

    my_field:"所有新闻"
    
  3. 我必须将原始单词放在 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:

  1. I had to escape the synonyms appearing on the right hand side, as follows:

    all news => weather\ forecast, sports, ...
    
  2. At query time, I had to wrap the query in double quotes. as follows:

    my_field:"all news"
    
  3. 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 技术交流群。

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

发布评论

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

评论(2

花海 2025-01-03 20:14:46

空格不是同义词配置文件中的分隔符。你不应该逃避它。

根据此处的文档:
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory

这应该只是

all seasons => winter, spring, summer, fall

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

all seasons => winter, spring, summer, fall
风情万种。 2025-01-03 20:14:46

通常,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/

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