Relevancy in results when searching by wildcard


(Michael) #1

Hi everyone

I'm have index with such data

{"id": "some_id",
"owner_id": "some_owner_id",
"created": "{some_creation_date}",
"tag": "some_tag",
"fields":{
{"first_name": "michael",
"last_name":"girnyak",
"name":"michael girnyak",
"phone": "66666666"}
}
{"id": "some_id",
"owner_id": "some_owner_id",
"created": "{some_creation_date}",
"tag": "some_tag",
"fields":{
"first_name": "anton",
"last_name": "koval",
"name": "anton koval",
"phone": "5555555"}
}
{"id": "some_id",
"owner_id": "some_owner_id",
"created": "{some_creation_date}",
"tag": "some_tag",
"fields":{
{"first_name": "brenda",
"last_name":"cristin",
"name":"brenda cristin",
"phone": "77777777"}
}
with mapping such as
{
"contact": {
"_all" : { "enabled" : False },
"_source" : { "enabled" : False },
"properties" : {
"id": {
"type": "string",
"store": "yes"
},
"owner_id": {
"type": "string",
"index": "not_analyzed",
},
"created": {
"type": "date",
"index": "not_analyzed",
"format" : "yyyy-MM-dd'T'HH:mm:ssZ"
},
"tag":{
"type": "string",
"index": "not_analyzed",
"omit_term_freq_and_positions": "true",
},
"fields": {
"type": "object",
"properties" : {
"first_name": {
"type": "string",
"index": "not_analyzed",
"omit_term_freq_and_positions": "true"
},
"last_name": {
"type": "string",
"index": "not_analyzed",
"omit_term_freq_and_positions": "true"
},
"name": {
"type": "string",
"index": "not_analyzed",
"omit_term_freq_and_positions": "true"
},
"phone":
"type": "string",
"index": "not_analyzed",
"omit_term_freq_and_positions": "true"
},
}
}
}

and try search by wildcard
{"query": {"wildcard": {"fields.first_name": "a"}}}
I want to have results in this direction
first item with first_name Anton
second item with first_name michAel
third item with first_name brendA
the search criteria must go from start of first_name field to end

what I need to do to get such results?
maybe I need to use some analyzer or some specific boosting
please help me with this I will be very appreciate


(Clinton Gormley) #2

Hi Michael

and try search by wildcard
{"query": {"wildcard": {"fields.first_name": "a"}}}
I want to have results in this direction
first item with first_name Anton
second item with first_name michAel
third item with first_name brendA
the search criteria must go from start of first_name field to end

what I need to do to get such results?
maybe I need to use some analyzer or some specific boosting
please help me with this I will be very appreciate

All wildcard matches return the score: 1.

If you want to use relevancy with partial matches, then you should look
at using the ngram or edge-ngram analyzers

clint


(Michael) #3

What actually I need to do? Could you explain me? Or may you give me some
example?
I try nGram analyzer but it don't give an results for me, the score is still
same for each of index data item. =((

On Wed, Jun 1, 2011 at 12:28 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

Hi Michael

and try search by wildcard
{"query": {"wildcard": {"fields.first_name": "a"}}}
I want to have results in this direction
first item with first_name Anton
second item with first_name michAel
third item with first_name brendA
the search criteria must go from start of first_name field to end

what I need to do to get such results?
maybe I need to use some analyzer or some specific boosting
please help me with this I will be very appreciate

All wildcard matches return the score: 1.

If you want to use relevancy with partial matches, then you should look
at using the ngram or edge-ngram analyzers

clint


(system) #4