I would like to write a specific fieldType that will work as shown at the example below:
Say we have a name: foo MooBar (f00B2r)
;
foo MooBar (f00B2r)
(and others with a "f")foo MooBar (f00B2r)
(and others with a "foo moob", etc.)foo MooBar (f00B2r)
foo MooBar (f00B2r)
foo MooBar (f00B2r)
My problems:
my fieldType in solr/conf/schema.xml:
<fieldType name="frontMatch" class="solr.TextField" positionIncrementGap="255">
<analyzer type="index">
<tokenizer class="solr.LowerCaseTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
</analyzer>
</fieldType>
P.S.
Sorry for my English and Thanks;
The solution for me:
Part of scheme.xml
<fieldType name="frontMatch" class="solr.TextField" positionIncrementGap="0" >
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
</analyzer>
</fieldType>
That solves the second problem.
To solve the first one:
Every query should be done with Proximity;
Number 1000000 is equal to operator "AND" when searching.
So, the search query looks like: name:"moobar f"~1000000
;
where name
is the field we're searching in;