2013-10-03 51 views
0

我已經索引2個全名用戶文檔:在Solr的 - 相關性受到影響錯用空格

fullname=Matt Cain 
fullName=Matt Harvey 

,當我搜索

fullName:Matt Harvey 

術語麥特·凱恩獲得更高的分數,但如果我搜索

fullName:matt OR fullName:harvey 

然後馬特哈維先來。

如何正確配置我的schema.xml,以便solr正確地處理它而不會手動中斷查詢?

這裏是從我目前的schema.xml

<fields> 
    <!-- general --> 
    <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/> 
    <field name="type" type="text_general" indexed="true" stored="true" multiValued="false"/> 
    <field name="name" type="text_general" indexed="true" stored="true" multiValued="false"/> 
    <field name="_version_" type="long" indexed="true" stored="true"/> 

    <field name="firstName" type="text_general" indexed="true" stored="true"/> 
    <field name="lastName" type="text_general" indexed="true" stored="true"/> 
    <field name="fullName" type="text_general" indexed="true" stored="true"/> 
    <field name="email" type="text_general" indexed="true" stored="true"/> 
    <field name="workPlace" type="text_general" indexed="true" stored="true"/> 
    <field name="geoArea" type="text_general" indexed="true" stored="true"/> 
    <field name="gender" type="text_general" indexed="true" stored="true"/> 
    <field name="tags" type="text_general" indexed="true" stored="true" multiValued="true"/> 
    <field name="birthDate" type="date" indexed="true" stored="true"/> 
    <field name="followersCount" type="long" indexed="true" stored="true"/> 
    <field name="featuredLevel" type="int" indexed="true" stored="true" multiValued="false"/> 

    <field name="fbId" type="text_general" indexed="false" stored="true"/> 
    <field name="imageUrl" type="text_general" indexed="false" stored="true"/> 

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

    <dynamicField name="*" type="ignored" multiValued="true"/> 

</fields> 

....一些相關部分

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"> 
     <analyzer type="index"> 
      <tokenizer class="solr.StandardTokenizerFactory"/> 
      <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> 
      <filter class="solr.LowerCaseFilterFactory"/> 
      <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> 
      <filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="15"/> 
     </analyzer> 
     <analyzer type="query"> 
      <tokenizer class="solr.StandardTokenizerFactory"/> 
      <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" /> 
      <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> 
      <filter class="solr.LowerCaseFilterFactory"/> 
     </analyzer> 
    </fieldType> 

如果有回答的問題,我會很高興地張貼所需的其他部位他們。不想發佈整個事情.. 謝謝

回答

0

fullName:Matt Harvey根據Lucene Syntax只搜索fullName:Matt。要解決此問題,您需要搜索fullName:"Matt Harvey"

相關問題