Difference between NGramFilterFactory and EdgeNGramFilterFactory

I am new to Solr. In my project NGramFilterFactory

, and EdgeNGramFilterFactory

two are used for the field. My understanding according to the doc is EdgeNGramFilterFactory

used for the request "starts with" and NGramFilterFactory

is appropriate for the request "contains".

I indexed a small dataset for both combinations (one in which I used only NGramFilterFactory

, and in the other I used both NGramFilterFactory

and EdgeNGramFilterFactory

), but I didn't see any difference in the output.

If my understanding is correct, the way EdgeNGramFilterFactory

is subset NGramFilterFactory

. If so, is there any advantage to using both types of filters in the same field?

+3


source to share


1 answer


You shouldn't use both filters on the same field, they will completely ruin your match. If you need a match in the middle of a token, you use NGrams. If you only need to align from the start, you use EdgeNGrams. Never both are together.



+5


source







All Articles