LoginSignup
0
1

More than 5 years have passed since last update.

Solrでシグモイド関数

Last updated at Posted at 2017-09-07

例えばsolrで売上ランキング3000位まではboostして検索結果上位に押し上げたいみたいなときに

bq=フィールド名:[0 TO 3000]^3

こんな感じでブーストを掛けちゃうと3000位と3001位の検索結果順に差が出すぎてしまいます。

なのでシグモイド関数を使って少し緩やかにブーストが掛かるよう
Solrのファンクションクエリでシグモイド関数を書きました。

y=2/(1+e^(0.001*(x-3000)))+1

syg.png

↑これをsolrで書くとこんな感じ

boost=sum(div(2,sum(1,exp(product(0.01,sub(【フィールド名】,3000))))),1)

(注)solrのboostはスコアに対して掛け算されるため+1をしないと0になっちゃうので足してます

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1