如何影响 Sphinx 结果权重

发布于 2024-12-15 11:27:30 字数 450 浏览 0 评论 0原文

我在这里有一个类似的问题:Sphinx 搜索排名损坏?,但我想我会问更简单的版本,看看我是否有任何点击。

有谁知道如何影响 Sphinx 搜索结果中的权重?专门用于精确匹配。

我知道更改排名模式会给你不同的权重尺度,但我得到的大多数点击都具有相同的权重,例如搜索“一次”会产生贬低的结果,例如:

"once we were warriors" weight = 1637
"once" weight = 1637
"Once upon a time in the west" weight = 1637

当然,至少第一个应该有不同的权重因为它是完全匹配的。

已经为此奋斗了几天,非常欢迎任何帮助。

I have a similar question here: Sphinx search ranking broken?, but thought I'd ask a simpler version of it to see if I got any hits.

Does anyone know how to affect the weights in Sphinx search results? Specifically for exact matches.

I know changing the ranking mode gives you different weight scales, but most of the hits I'm getting have the same weight, for example searching for "once" produces disparaging results like:

"once we were warriors" weight = 1637
"once" weight = 1637
"Once upon a time in the west" weight = 1637

Surely, at least the first one should have a different weight since it's an exact match.

Been fighting this for a couple of days, any help would be very welcome.

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

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

发布评论

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

评论(5

怪我入戏太深 2024-12-22 11:27:30

Sphinx 论坛中也提出了相同类型的问题。

$cl->setMatchMode(SPH_MATCH_EXTENDED);
$cl->setRankMode(SPH_RANK_WORDCOUNT);

$cl->Query('"^public work place$ | "public work place" | (public work place) | "public work place"/1 | (*public* *work* *place*)',$index);

这对我有用,首先获得完全匹配,然后按顺序获得短语等。

注意:这里不是获得不同的权重,而是根据提供的查询设置结果顺序。我认为最好在不改变不同权重的情况下获得结果,这将需要更多的计算,并最终节省时间和金钱。 :-)

这在我的系统中有效并经过测试(Sphinx 0.9.9-release -r2117)。


The same type of a question was asked in the Sphinx forum.

$cl->setMatchMode(SPH_MATCH_EXTENDED);
$cl->setRankMode(SPH_RANK_WORDCOUNT);

$cl->Query('"^public work place$ | "public work place" | (public work place) | "public work place"/1 | (*public* *work* *place*)',$index);

This works for me and getting the exact match first and then the phrase etc. in order.

NOTE: here instead of getting different weight the result order is set according to the query provided. I think it is better get the result without changing different weight that will require more computation, and ultimately save time and money. :-)

This works in my system and tested (Sphinx 0.9.9-release -r2117 ).


暖风昔人 2024-12-22 11:27:30

我刚刚用这种东西测试了 SPH_RANK_SP04 ,似乎有效。

我已将此测试工具升级为使用 sphinx 2.01(以便 SPH04 可用)

http://www.nearby.org.uk/sphinx/searchtest.php?q=one&ranking=7

注意“one”本身获得最高的可能 重量。

I just tested SPH_RANK_SP04 with this sort of thing, seems to work.

I've upgraded this testing tool to use sphinx 2.01 (so that SPH04 is available)

http://www.nearby.org.uk/sphinx/searchtest.php?q=one&ranking=7

notice 'one' on its own gets the highest possible weight.

梦开始←不甜 2024-12-22 11:27:30

此处类似的讨论:Sphinx 搜索排名已损坏?。我创建了另一个问题,希望通过简化事情我能得到更多答案,因为没有任何答案。

事实证明,SPH_RANK_SPH04 并未包含在 0.9.9 版本(发布)的 sphinxapi.php 文件中!因此,即使您调用它,它也不会被考虑在内,而且不会产生错误。

这很糟糕,因为它使得故障排除变得非常困难。

我将其作为答案发布,希望对其他人有所帮助。我们为此疯狂地浪费了将近两天的时间,直到我们弄清楚了。

此外,2.0.1 中有一个错误,它并没有真正将一些精确的匹配带到前面,因为你需要 2.0.2(你需要从 SVN 获得)或更高版本,但我会非常厌倦在生产中使用实验版本。

希望 Sphinx 开发人员能够尽快解决这个问题。

聚苯乙烯
回顾开发者日记,它确实说:

“从 1.10-beta 开始,Sphinx 有 8 个不同的排名器”

我们从 0.9.9 升级到 2.0.1,并且必须留下 api 文件,绝望中我什至从未检查过这。如果排名模式不存在(就像匹配等其他模式一样),Sphinx 抛出错误仍然是件好事,而且据我们在测试中所知,2.0.1 的错误仍然存​​在。

Similar discussion here: Sphinx search ranking broken?. I created another question in the hopes that by simplifying things I would get more answers since none were forthcoming.

Turns out that SPH_RANK_SPH04 is not included in the sphinxapi.php file in version 0.9.9 (release)!!! So even though you're calling it it's not taken into account and furthermore does not produce an error.

This is terrible because it makes it very hard to troubleshoot.

I've posted this as the answer in the hopes that it helps someone else. We lost almost 2 days going crazy over this until we figured it out.

Furthermore, there is a bug in 2.0.1 which doesn't really bring some exact matches to the front, for that you need 2.0.2 (which you need to get from SVN) or above, but I'd be very weary of using experimental versions in production.

Hopefully the Sphinx developers will take care of this soon.

PS
Looking back at the developer diaries, it does say:

"As of 1.10-beta, Sphinx has 8 different rankers"

We upgraded from 0.9.9 to 2.0.1 and must have left the api file behind, and in desperation I never even checked this. It would still be nice for Sphinx to throw an error if the ranking mode doesn't exist (as it does for other modes such as matching), and the 2.0.1 bug is still there as far as we can tell in our tests.

少跟Wǒ拽 2024-12-22 11:27:30

我在 PECL Sphinx 模块中遇到了同样的问题,我想我已经通过定义缺失的常量解决了这个问题:

define ( "SPH_RANK_PROXIMITY", 4 );
define ( "SPH_RANK_MATCHANY", 5 );
define ( "SPH_RANK_FIELDMASK", 6 );
define ( "SPH_RANK_SPH04", 7 );
define ( "SPH_RANK_EXPR", 8 );
define ( "SPH_RANK_TOTAL",9 );

希望有帮助。

i've encountered the same issue with the PECL Sphinx module, and i think i've solved this by defining the missing constants:

define ( "SPH_RANK_PROXIMITY", 4 );
define ( "SPH_RANK_MATCHANY", 5 );
define ( "SPH_RANK_FIELDMASK", 6 );
define ( "SPH_RANK_SPH04", 7 );
define ( "SPH_RANK_EXPR", 8 );
define ( "SPH_RANK_TOTAL",9 );

Hope this help.

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