Custom Completion


(Sang Dang) #1

Hi,
I follow step by step here:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html

The data I input is:

curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{

"name" : "Nevermind",

"suggest" : {

    "input": [ "Nevermind XYZ", "Nirvana ABC" ],

    "output": "Nirvana - Nevermind X",

    "payload" : { "artistId" : 2321 },

    "weight" : 34

}

}'

I try to suggest with :

curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{

"song-suggest" : {

    "text" : "nevermind x",

    "completion" : {

        "field" : "suggest"

    }

}

}'

Then it's ok.

My current suggest system (which refer from Cleo) could suggest at the
middle of phrase (not only prefix).

ex: when user suggest for "xy", the suggest system should output "Nirvana -
Nevermind X" because it match "Nevermind XYZ"

To do it, currently I enrich my data when indexing, ex:

When user index: "Nevermind XYZ ABC DEF"

I will split word and index: "Nevermind XYZ ABC DEF", "XYZ ABC DEF", "ABC
DEF", "DEF".

I would prefer another way to do it, I have tried by set custom tokenizer
etc ... but I don't success yet.

Would anyone help me on this situation ?
I really appreciate your help.

Thanks.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Kurt Hurtado) #2

I've always done it that way, by simply adding inputs when indexing... and
it works great. But I've also wondered if there's a Better Way!
Thanks,
Kurt

On Tuesday, November 19, 2013 3:12:57 AM UTC-8, kidkid wrote:

Hi,
I follow step by step here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html

The data I input is:

curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{

"name" : "Nevermind",

"suggest" : {

    "input": [ "Nevermind XYZ", "Nirvana ABC" ],

    "output": "Nirvana - Nevermind X",

    "payload" : { "artistId" : 2321 },

    "weight" : 34

}

}'

I try to suggest with :

curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{

"song-suggest" : {

    "text" : "nevermind x",

    "completion" : {

        "field" : "suggest"

    }

}

}'

Then it's ok.

My current suggest system (which refer from Cleo) could suggest at the
middle of phrase (not only prefix).

ex: when user suggest for "xy", the suggest system should output "Nirvana

  • Nevermind X" because it match "Nevermind XYZ"

To do it, currently I enrich my data when indexing, ex:

When user index: "Nevermind XYZ ABC DEF"

I will split word and index: "Nevermind XYZ ABC DEF", "XYZ ABC DEF", "ABC
DEF", "DEF".

I would prefer another way to do it, I have tried by set custom tokenizer
etc ... but I don't success yet.

Would anyone help me on this situation ?
I really appreciate your help.

Thanks.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Sang Dang) #3

Yes,
The same here, I (and maybe alot of people) have solved this by enrich data.
But I still wonder if there has any better way.

As my knowledge, the FST would similar to Adjancency List, which would not
increase much space in same data -> so we could enrich data without be
worry about memory.

Could anyone confirm for this ?

On Tuesday, November 19, 2013 1:19:41 PM UTC-8, Kurt Hurtado wrote:

I've always done it that way, by simply adding inputs when indexing... and
it works great. But I've also wondered if there's a Better Way!
Thanks,
Kurt

On Tuesday, November 19, 2013 3:12:57 AM UTC-8, kidkid wrote:

Hi,
I follow step by step here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html

The data I input is:

curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{

"name" : "Nevermind",

"suggest" : {

    "input": [ "Nevermind XYZ", "Nirvana ABC" ],

    "output": "Nirvana - Nevermind X",

    "payload" : { "artistId" : 2321 },

    "weight" : 34

}

}'

I try to suggest with :

curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{

"song-suggest" : {

    "text" : "nevermind x",

    "completion" : {

        "field" : "suggest"

    }

}

}'

Then it's ok.

My current suggest system (which refer from Cleo) could suggest at the
middle of phrase (not only prefix).

ex: when user suggest for "xy", the suggest system should output "Nirvana

  • Nevermind X" because it match "Nevermind XYZ"

To do it, currently I enrich my data when indexing, ex:

When user index: "Nevermind XYZ ABC DEF"

I will split word and index: "Nevermind XYZ ABC DEF", "XYZ ABC DEF", "ABC
DEF", "DEF".

I would prefer another way to do it, I have tried by set custom tokenizer
etc ... but I don't success yet.

Would anyone help me on this situation ?
I really appreciate your help.

Thanks.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4