LoginSignup
1
2

More than 5 years have passed since last update.

Fess 検索クエリのブースト値を変更する

Posted at

Fess 10.3
検索クエリに設定するブースト値を変更します。

変更方法

  1. fess_config.propertiesを変更
  2. Fessを再起動
app/WEB-INF/classes/fess_config.properties
# boost
query.boost.title=0.1
query.boost.title.lang=0.5
query.boost.content=0.2
query.boost.content.lang=1.0

特定のフィールドを検索するときにブーストさせたい場合は
フィールドを追加することもできます。

確認方法

Query Boostの値を確認するにはFessのアプリ側のログレベルを変更します。

fess.in.sh
"$FESS_JAVA_OPTS -Dfess.log.level=debug"

Fessを再起動して検索するとfess.logで確認できます。

fess.log
DEBUG Query: {
  "from" : 0,
  "size" : 20,
  "query" : {
    "bool" : {
      "must" : {
        "function_score" : {
          "query" : {
            "bool" : {
              "should" : [ {
                "match" : {
                  "title" : {
                    "query" : "fess",
                    "type" : "phrase",
                    "boost" : 0.1
                  }
                }
              }, {
                "match" : {
                  "content" : {
                    "query" : "fess",
                    "type" : "phrase",
                    "boost" : 0.2
                  }
                }
              }, {
                "match" : {
                  "title_en" : {
                    "query" : "fess",
                    "type" : "phrase",
                    "boost" : 0.5
                  }
                }
              }, {
                "match" : {
                  "content_en" : {
                    "query" : "fess",
                    "type" : "phrase",
                    "boost" : 1.0
                  }
                }
              }, {
                "match" : {
                  "title_ja" : {
                    "query" : "fess",
                    "type" : "phrase",
                    "boost" : 0.5
                  }
                }
              }, {
                "match" : {
                  "content_ja" : {
                    "query" : "fess",
                    "type" : "phrase",
                    "boost" : 1.0
                  }
                }
              } ]
            }
          },
          "functions" : [ {
            "field_value_factor" : {
              "field" : "boost"
            }
          } ]
        }
      },
1
2
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
1
2