You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Ji, Jason" <jj...@ea.com> on 2011/10/27 00:53:09 UTC

exact matches are not filtered to the top

Hi guys,

We have a case that we need to do wildcard search for either user's realname or username.(note that realname is not mandatory)
So we specified the copyField as below:

  <field name="username" type="text" indexed="true" stored="true" required="true"/>
  <field name="realname" type="text" indexed="true" stored="true" required="false"/>


<copyField source="realname" dest="searchable"/>
<copyField source="username" dest="searchable"/>

   <field name=" searchable " type="text" indexed="true" stored="false" multiValued="true"/>


<fieldType name="text" class="solr.TextField"  positionIncrementGap="100">
      <analyzer type="index" >
        <tokenizer class="solr.NGramTokenizerFactory" minGramSize="1" maxGramSize="25"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
      <analyzer type="query"  >
        <tokenizer class="solr.KeywordTokenizerFactory" />
        <filter class="solr.SynonymFilterFactory" synonyms="english_names.txt" ignoreCase="true" expand="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>


But the problem is that when the search results are displayed , the exact matches are not filtered to the top.

This should be a simple use case, anyone can suggest when goes wrong ?

Thanks,
Jason