Ngram and Huspell analyzers in common index

I want to combine full text search with autocomplete in a search field. I use a hunspell token filter in the main analyzer for searching. But I want to add ngram in addition.

When I type queries in a search field letter by letter I can see results from time to time (only in those cases when my tokenized query matched at least with one stem) otherwise results will be empty (in a moment when word has been written partly for example). In shuch situations I want to add ngram working results in order to avoid emptiness.

Should I do 2 indexes for this reason. In the first index I will keep data which have been stored by hunspell tokenizer. In the second with Ngram. This separation helps to avoid mixing saved tokens (stems) of both analyzers(tokenizers). As consequence I have to send second request in case when the first response (to 1 index) is empty.

If I keep all data in one index which processed by both analyzers a tokens intersection of different analyzers will interfere in relevance scoring.

Is there elegant way to solve this problem using only one index??

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.