partial text matching in middle of word

475 Views Asked by At

I'm trying to get partial word matching working in solr.

So I have a schema set-up like this:

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <!-- in this example, we will only use synonyms at query time
    <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
    -->
    <!-- Case insensitive stop word removal.
         enablePositionIncrements=true ensures that a 'gap' is left to
         allow for accurate phrase queries.
    -->
    <filter class="solr.StopFilterFactory"
            ignoreCase="true"
            words="stopwords.txt"
            enablePositionIncrements="true"
            />
    <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
    <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
    <filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="1000" side="front" />
    <filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="1000" side="back" />
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
    <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
    <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  </analyzer>
</fieldType>

<field name="key"     type="string" indexed="false" stored="true" required="true" />
<field name="uid"     type="string" indexed="true"  stored="true" required="true" />

<field name="organisationid"     type="string" indexed="true"  stored="true" required="false" />
<field name="organisationname" type="text" indexed="true" stored="true" required="false" />
<field name="organisationcleanname" type="text" indexed="true" stored="true" required="false" />

<field name="practiceareas"     type="string"    indexed="true"  stored="true" required="false" multiValued="true" />
<field name="subeditions"     type="string"    indexed="true"  stored="true" required="false" multiValued="true" />

I've indexed all the data i want to and have a few organisation names such as:

  • A Kings Name
  • Block Me
  • All
  • King and Wood
  • Hacking me Softly

When I do a search using: (organisationname:king OR organisationcleanname:king) AND practiceareas:20 Hacking me Softly doesn't come back in the results (yes it has a practicearea of 20). Have I set up the NGram incorrectly?

0

There are 0 best solutions below