Hi All,
My purpose is to make a autosuggest.
example: use type* Heal Th*
then suggest: I heal the world, heal the world, heal them ....
So with ES, I use edgeNGram to index and default for search:
Let see my config first:
index:
analysis:
filter:
my_gram_filter:
type: edgeNGram
side: front
min_gram: 1
max_gram: 10
tokenizer:
my_gram:
type: edgeNGram
side: front
min_gram: 1
max_gram: 10
analyzer:
default:
tokenizer: standard
filter: [asciifolding,lowercase]
auto:
type: custom
tokenizer: my_gram
filter: [asciifolding,lowercase]
auto2:
type: custom
tokenizer: standard
filter: [standard,lowercase,asciifolding,my_gram_filter]
you could see that:
auto: use edgeNgram at tokenizer
aut2: use edgeNgram at filter.
For example, with the test:* "Hello World"*
Auto will : h, he, hel, hell, hello, hello , hello w, hello wo, hello
wor, hello worl, hello world
Auto2 will: h, he, hel, hell, hello, w, wo, wor, worl, world
The problem is:
#1: Which is better for suggestion for my above purpose ?
#2: Which type of search request should I do ?
I have tried
with: textPhrasePrefixQuery, prefixQuery, textQuery, textPhraseQuery, wildcardQuery, fieldQuery, termQuery, spanTermQuery
with use default analyzer. and I found that:
only textPhrasePrefixQuery match to my purpose. But it cause the problem too
many clauses failure (default 1024) ....
I have tried with wildcard, text Query, but it is strange work.
For other query (Excep textPhrasePrefixQuery) I have checked and found that
it have several problems as bellow:
Don't match more then two words. ex: search hello will give "*hello
world*" but search hello world will show nothing.
Don't match partial at world. ex: search "hello " will show nothing.
Don't match exactly . ex: search "hello w" will show "hello abc"
Hope anyone could help me :
- which analyzer, filter for index & search should I use for my above
purpose ? - how does ES compare between search-analyzer and index-analyzer to match
result ?
Thanks in advance.
Sang Dang.
--