Hi Johan,

thanks for the reply

I would agree that it's ok, if I am searching for common term, like 
'venue', 'club' or 'bar', but when it comes to User names, it make sense to 
score the position in the field too, because when you search in field 
user.name, and type 'Jo' you would expect first to see users with first 
name Joe, Johan, John, rather than having users with Jo in the family.

And especially when you search for user name field you don't expect to have 
more occurrence of the name  in that field.



On Wednesday, January 22, 2014 9:30:19 PM UTC, Johan Rask wrote:
>
> Lucene will calculate you score based on a scoring formula. I am pretty 
> sure that the location of the word is not part of this formula but rather 
> how common the
> word is in your sentence. I.e multiple occurences of 'venue' should 
> increase scoring and adding other words to your sentence should decrease 
> the scoring.
>
> Hope this helps, I am pretty sure there is detailed info about this in the 
> lucene docs. 
>
> Kind regards /Johan
>
> Den onsdagen den 22:e januari 2014 kl. 13:10:00 UTC+1 skrev Nikolay 
> Chankov:
>>
>> I am playing with elasticsearch so far, and i noticed something:
>>
>> If I search for a word in a string, the _score is equal no matter where 
>> is placed the word. Here I have prepared a test case:
>>
>> curl -XDELETE 'http://localhost:9200/test_search'
>> curl -XPUT 'http://localhost:9200/test_search/' -d '
>> {
>>     "mappings" : {
>>         "test_record" : {
>>             "properties" : {
>>                 "name" : { 
>>                     "type" : "string"
>>                 }
>>             }
>>         }
>>     }
>> }'
>>
>> curl -XPUT 'http://localhost:9200/test_search/test_record/1' -d '{
>>     "name" : "is the name Venue of that one"
>> }'
>>
>> curl -XPUT 'http://localhost:9200/test_search/test_record/2' -d '{
>>     "name" : "is the name of that one Venue"
>> }'
>>
>> curl -XPUT 'http://localhost:9200/test_search/test_record/3' -d '{
>>     "name" : "Venue is the name of that one"
>> }'
>>
>> curl -XGET 'http://localhost:9200/test_search/_search' -d '{
>>     "query": {
>>         "bool": {
>>             "must": [ ],
>>             "must_not": [ ],
>>             "should": [
>>                 {
>>                     "query_string" : {
>>                         "default_field": "_all",
>>                         "query" : "venue"
>>                     }
>>                 }
>>             ]
>>         }
>>     },
>>     "from": 0,
>>     "size": 10
>> }'
>>
>> The question is: how to have different score based on the position of the 
>> word 'venue' in the test. When I search I would expect results to be 
>> ordered 3,1,2 while now they are as they are inserted ,1,2,3.
>>
>> Any hint will be much appreciated
>>
>

-- 
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/d2d79908-0131-4220-941c-eb31e51b9667%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to