Solr search with EdgeNGramFilterFactory and minimum search query length

in my solr schema file, I have a default search field that uses EdgeNGramFilterFactory

<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="15" side="front" />

suggested that my search query

tes

so I get these results:

tess
test
tesla
...

if i am looking

test

I get results like

test
tess
tesla
...

Good, because I use EdgeNGramFilterFactory with minGramSize = 3 , but I want the following:

When I search for a string longer than 3 characters (for example, a test), I want solr to ignore all terms that consist of 3 characters (EdgeNGramFilterFactory). When I search for a “test”, I don’t want to get results like “tess” or “tesla”. I will not get results that start with a test (4 characters), for example

test
test for
test-drive
...

Is it possible to configure this in solr?

+5
1

EdgeNGram ; , - EdgeNGram. , "" "".

config, . ( EdgeNGram )

<fieldType name=...>
    <analyzer type="index">
        ...
        <filter class="solr.EdgeNGramFilterFactory" minGramSize="4" maxGramSize="15" side="front" />
    </analyzer>
    <analyzer type="query">
        ...
        <!-- <filter class="solr.EdgeNGramFilterFactory" minGramSize="4" maxGramSize="15" side="front" /> -->
    </analyzer>
</fieldType>
+5

All Articles