Im using completion suggester for autocomplete.. These are my documents
/* doc 1 */
{
Title: CineMAX: Inorbit Mall, Cyberabad
Suggest: {
input: [
CineMAX:
Inorbit
Mall
Cyberabad
CineMAX: Inorbit Mall, Cyberabad
]
output: CineMAX: Inorbit Mall, Cyberabad
payload: {
....
}
weight: 1
}
}
/* doc 2 */
{
Title: INOX: Kolkata
Suggest: {
input: [
INOX:
Kolkata
INOX: Kolkata
]
output: INOX: Kolkata
payload: {
....
}
weight: 1
}
}
Im using completion query as below
{
"suggestion":{
"text":"inox",
"completion":{
"field":"Suggest",
"fuzzy":{
"edit_distance":1,
"transpositions":true,
"prefix_length":1,
"min_length":4
}
}
}
}
But here i am getting the output as
I want to give more priority to exact match.. so i want INOX: Kolkata in the top..
I have splitted the title using php explode().. so i can match middle words also..I don know how to boost specific words in the title..Plz help me.. Thanks in advance
You can try running two completion queries like this:
{
"text": "inox",
"suggestion_not_fuzzy": {
"completion": {
"field": "Suggest"
}
},
"suggestion_fuzzy": {
"completion": {
"field": "Suggest",
"fuzzy": {
"edit_distance": 1,
"transpositions": true,
"prefix_length": 1,
"min_length": 4
}
}
}
}
and then try to get the results from "suggestion_not_fuzzy", if empty fallback to "suggestion_fuzzy"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With