Hi,

Please run the below statements -

curl -X DELETE localhost:9200/autocomplete_scoring

curl -X PUT localhost:9200/autocomplete_scoring -d '
{
  "settings" : {
    "index" : {
      "analysis" : {
        "analyzer" : {          
  "translation_index_analyzer" : {
    "type" : "custom",
"tokenizer" : "standard",
"filter" : "standard, lowercase,title_edgeNgram"
  },
  "translation_search_analyzer" : {
    "type" : "custom",
"tokenizer" : "standard",
"filter" : "standard, lowercase"
  }
        },
        "filter" : {
          "title_edgeNgram" : {
            "type" : "edgeNGram",
            "min_gram" : 1,
            "max_gram" : 10
          }
        }
      }
    }
  },
  "mappings": {
    "autoCompleter": {
      "properties": {
        "name": {
          "type": "string",
  "index_analyzer": "translation_index_analyzer",
          "search_analyzer": "translation_search_analyzer"
        },
"hit": {
          "type": "long"
        },
"lastAccessedDate": {
          "type": "date"
        }
      }
    }
  }
}
'
curl -X POST "http://localhost:9200/autocomplete_scoring/suggestion"; -d '{ 
"name" : "abc","hit" : 1, "lastAccessedDate" : "2014-07-08T08:00:00" }'
curl -X POST "http://localhost:9200/autocomplete_scoring/suggestion"; -d '{ 
"name" : "abc radio","hit" : 1, "lastAccessedDate" : "2014-07-01T08:00:00" 
}'

curl -XPOST 
"http://localhost:9200/autocomplete_scoring/_search?pretty=True"; -d'
{
    "explain": true,
"query": {
    "function_score": {
    "query":{
            "match":{
               "name":"abc"
            }
         }
    }
}
}'

== > From the result -
"_source":{ "name" : "abc radio","hit" : 1, "lastAccessedDate" : 
"2014-07-01T08:00:00" },
      "_explanation" : {
        "value" : 0.4451987,
        "description" : "weight(name:abc in 0) [PerFieldSimilarity], result 
of:",
        "details" : [ {
          "value" : 0.4451987,
          "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.71231794,
            "description" : "idf(docFreq=3, maxDocs=3)"
          }, {
            "value" : 0.625,
            "description" : "fieldNorm(doc=0)"
          } ]
        } ]
      }

Here the tf is 1.0 ?
How.
In my opinion it should be 1/2=0.5

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/3b7e340d-87ba-49eb-8923-a8800178526d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to