1

「説明」を使用しても、クエリのスコアリングがどのように行われているかがわかりません。スコアは恣意的なようです。おそらく、Elastic Search をよりよく理解している人が説明してくれませんか?

私の設定とマッピングは次のようになります (私はタイヤを使用しています):

  settings :analysis => {
            :analyzer => {
              :nickname => {
                :tokenizer => "standard",
                :filter    => ["stop", "nickname_words", "lowercase"],
                :type      => "custom"
              }
            },
            :filter => {
              :nickname_words  => { :type => "word_delimiter", :generate_word_parts => true, :generate_number_parts => true,
                                    :split_on_numerics => true, :split_on_case_change => true, :catenate_words => true,
                                    :preserve_original => true }
            }
          }

  mapping do
    indexes :id,       :type => "integer", :index => :not_analyzed, :include_in_all => false
    indexes :nickname, :type => "string",  :index_analyzer => :nickname, :search_analyzer => :standard, :include_in_all => true
  end

たとえば、「test」というニックネームに対して一致クエリを実行すると、次のように返されます。

{
  "took" : 5,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 3,
    "max_score" : 1.0,
    "hits" : [ {
      "_shard" : 2,
      "_node" : "YE2N_R_qRMaXmcdobaMkWQ",
      "_index" : "users",
      "_type" : "user",
      "_id" : "6",
      "_score" : 1.0, "_source" : {"id":6,"nickname":"test242424"},
      "_explanation" : {
        "value" : 1.0,
        "description" : "weight(nickname:test in 0) [PerFieldSimilarity], result of:",
        "details" : [ {
          "value" : 1.0,
          "description" : "fieldWeight in 0, product of:",
          "details" : [ {
            "value" : 1.0,
            "description" : "tf(freq=1.0), with freq of:",
            "details" : [ {
              "value" : 1.0,
              "description" : "termFreq=1.0"
            } ]
          }, {
            "value" : 1.0,
            "description" : "idf(docFreq=1, maxDocs=2)"
          }, {
            "value" : 1.0,
            "description" : "fieldNorm(doc=0)"
          } ]
        } ]
      }
    }, {
      "_shard" : 3,
      "_node" : "YE2N_R_qRMaXmcdobaMkWQ",
      "_index" : "users",
      "_type" : "user",
      "_id" : "7",
      "_score" : 1.0, "_source" : {"id":7,"nickname":"SecondTest353535"},
      "_explanation" : {
        "value" : 1.0,
        "description" : "weight(nickname:test in 0) [PerFieldSimilarity], result of:",
        "details" : [ {
          "value" : 1.0,
          "description" : "fieldWeight in 0, product of:",
          "details" : [ {
            "value" : 1.0,
            "description" : "tf(freq=1.0), with freq of:",
            "details" : [ {
              "value" : 1.0,
              "description" : "termFreq=1.0"
            } ]
          }, {
            "value" : 1.0,
            "description" : "idf(docFreq=1, maxDocs=2)"
          }, {
            "value" : 1.0,
            "description" : "fieldNorm(doc=0)"
          } ]
        } ]
      }
    }, {
      "_shard" : 0,
      "_node" : "YE2N_R_qRMaXmcdobaMkWQ",
      "_index" : "users",
      "_type" : "user",
      "_id" : "4",
      "_score" : 0.30685282, "_source" : {"id":4,"nickname":"test123"},
      "_explanation" : {
        "value" : 0.30685282,
        "description" : "weight(nickname:test in 0) [PerFieldSimilarity], result of:",
        "details" : [ {
          "value" : 0.30685282,
          "description" : "fieldWeight in 0, product of:",
          "details" : [ {
            "value" : 1.0,
            "description" : "tf(freq=1.0), with freq of:",
            "details" : [ {
              "value" : 1.0,
              "description" : "termFreq=1.0"
            } ]
          }, {
            "value" : 0.30685282,
            "description" : "idf(docFreq=1, maxDocs=1)"
          }, {
            "value" : 1.0,
            "description" : "fieldNorm(doc=0)"
          } ]
        } ]
      }
    } ]
  }
}                                                                   

最も類似しているため、test123 が SecondTest353535 および test24242424 の前に来ると思います。

なぜこうなった?

4

0 に答える 0