Solr 查询行为

发布于 2024-10-30 18:21:03 字数 365 浏览 7 评论 0原文

我有一个包含食谱的 Solr 安装。

每个食谱都有多种成分,我目前正在构建一个食谱搜索,您可以输入“包含/排除”,然后我有一个在此之后出现的自制重量系统。

然而,查询构建尚未完成,因此需要改进。

// Works perfect - 109 results
ingredients:chicken OR tomatoes OR bacon

// Down to 7 results - Definitely wrong
ingredients:chicken OR tomatoes OR bacon AND -ingredients:garlic 

我尝试过以任何方式构建此查询,但无法找出可接受的“模糊过滤器”

I have a Solr installation that contains recipes.

Each recipe has multiple ingredients and I'm currently building a recipe search that you can type 'includes/excludes' and then I have a homebrew weight system that comes in after this.

The query building is off however and so needs refining.

// Works perfect - 109 results
ingredients:chicken OR tomatoes OR bacon

// Down to 7 results - Definitely wrong
ingredients:chicken OR tomatoes OR bacon AND -ingredients:garlic 

I've tried building this query any which way but can't figure out an acceptable 'fuzzy filter'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

独享拥抱 2024-11-06 18:21:03

我会这样做:

ingredients:((chicken OR tomatoes OR bacon) AND NOT garlic)

这对我有用。

您可以像这样添加所有排除项:

ingredients:((chicken OR tomatoes OR bacon) AND NOT (garlic OR peanuts OR spinach))

I would do:

ingredients:((chicken OR tomatoes OR bacon) AND NOT garlic)

This works for me.

You can add all excludes like this:

ingredients:((chicken OR tomatoes OR bacon) AND NOT (garlic OR peanuts OR spinach))
雨后咖啡店 2024-11-06 18:21:03

尝试ingredients:鸡肉或西红柿或培根和(-ingredients:大蒜)

我假设您正在将Solr 3.1与edismax一起使用。

我发现将否定查询括在括号中是有效的。我没有时间更详细地研究这个问题并弄清楚这是否是预期的行为还是一个错误。如果您更详细地调查此问题并确认这是一个错误,请在此处< /a>.

请注意,我上面建议的查询将根据您的配置在默认字段中搜索西红柿/培根。如果您只想在ingredients中搜索它们,请使用ingredients:(chicken ORmatoor OR bacon) AND (-ingredients:garlic)

Try ingredients:chicken OR tomatoes OR bacon AND (-ingredients:garlic)

I am assuming that you are you are using Solr 3.1 with edismax.

I have found that enclosing negative queries in parenthesis works. I have not had the time to look into this in more detail and figure out if this is the expected behaviour or is it a bug. If you investigate this in more detail and confirm that this is a bug, then please open a Jira issue here.

Note that the query I suggested above will search for tomatoes / bacon in the default field(s) as per your config. If you want to search for them in ingredients only, then use ingredients:(chicken OR tomatoes OR bacon) AND (-ingredients:garlic)

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