开发者

SOLR: Boosting based on location of search term in field

开发者 https://www.devze.com 2023-02-28 06:37 出处:网络
I\'m building a search engine with SOLR, and when an user searches for a phrase such as \"apple\", I get results such as:

I'm building a search engine with SOLR, and when an user searches for a phrase such as "apple", I get results such as:

开发者_JAVA百科

Babyfood, apple ... apple, raw

I want "apple, raw" to appear ahead of "babyfood, apple" because the word apple appears in the front. Is there a way to do this with SOLR? To give more score to those results where the search term appears more in the front?


try q=(field:apple*)^2 OR field:apple

where field is the name of the field against which you are searching

0

精彩评论

暂无评论...
验证码 换一张
取 消