solr sorting space issues

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

solr sorting space issues

greeshma
This post has NOT been accepted by the mailing list yet.
solr sorts strings with space as the first one. if it has to sort " sim", "albert", "bim". the results are:

sim albert bim

since sim has space at the begining it will be first. below is my schema:

<fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
             <filter class="solr.LowerCaseFilterFactory" />
       
        <filter class="solr.TrimFilterFactory" updateOffsets="true" />
       <filter class="solr.PatternReplaceFilterFactory"
                pattern="([^a-z])" replacement="" replace="all"
        /> 
      </analyzer>
    </fieldType>
 <fieldType name="textName" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.CJKTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
        <filter class="solr.TrimFilterFactory" updateOffsets="true" />
     
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.CJKTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
        <filter class="solr.TrimFilterFactory" updateOffsets="true" />
     
      </analyzer>
    </fieldType>
 
  <field name="name" type="textName" indexed="true" stored="true" />
   <field name="nameSort" type="string" indexed="true" stored="false"/>
   <field name="alphaNameSort" type="alphaOnlySort" indexed="true" stored="false"/>

  <copyField source="name" dest="nameSort"/> 
   <copyField source="name" dest="alphaNameSort"/>