gpt4 book ai didi

包含某些特定单词的 Solr Negative Boost 查询结果

转载 作者:行者123 更新时间:2023-12-04 00:25:34 24 4
gpt4 key购买 nike

我有一个字段 item_name,在 Solr 5.0.0 中索引。如何对包含某些特定词的查询结果进行负面提升?

例如,假设我有 item_name 这样的:

Feggi Brown Laptop Bags
Dell Laptop (Black) without Laptop Bag by Dell
HP Laptop with Laptop Bag
Sony laptop without bag
Goldendays Laptop Bag

如果我搜索laptop bags,它会返回如下结果:

Dell Laptop (Black) without Laptop Bag by Dell
HP Laptop with Laptop Bag
Feggi Brown Laptop Bags
Sony laptop without bag
Goldendays Laptop Bag

我怎样才能对包含以下单词的 item_name 给予负面或低提升:

with, without, ...

目标是让包含这些词的 item_name 不在结果的顶部?

注意:在此上下文中与 stopwords 有任何关系吗?

最佳答案

documentation of Solr可以帮助你:

True negative boosts are not supported, but you can use a very "low" numeric boost value on query clauses. In general the problem that confuses people is that a "low" boost is still a boost, it can only improve the score of documents that match. For example, if you want to find all docs matching "foo" or "bar" but penalize the scores of documents matching "xxx" you might be tempted to try...

q = foo^100 bar^100 xxx^0.00001    # NOT WHAT YOU WANT 

...but this will still help a document matching all three clauses score higher then a document matching only the first two. One way to fake a "negative boost" is to give a large boost to everything that does not match. For example...

q =  foo^100 bar^100 (*:* -xxx)^999

所以在你的情况下,你必须做类似的事情:

q = item_name:laptop^100 item_name:bags^100 (*:* -item_name:with)^99 (*:* -item_name:without)^99

如果您使用 (e)dismax,Solr's documentation告诉:

When using (e)dismax, people sometimes expect that specifying a pure negative query with a large boost in the "bq" param will work (since Solr automatically makes top level purely negative positive queries by adding an implicit ":" --) but this doesn't work with "bq", because of how queries specified via "bq" are added directly to the main query. You need to be explicit...

? defType = dismax 
& q = foo bar
& bq = (*:* -xxx)^999

在您的情况下,似乎与stopwords 没有联系。

关于包含某些特定单词的 Solr Negative Boost 查询结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30752587/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com