update, I tried changing to datatype string, and it sorts the numerics better, but the other sorts are not as good.

Is there a way to control sorting for special chars, for example, I want blanks to sort after letters and numbers.

using alphaOnlySort - sorts nicely for alpha, but numbers dont work
string - sorts nicely for numbers and letters, but special chars like blanks show up first in the list

thanks
Joel

On Dec 24, 2009, at 11:20 AM, Joel Nylund wrote:

I have a field:

<field name="title" type="alphaOnlySort" indexed="true" stored="true" required="false"/>


<fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
     <analyzer>
       <!-- KeywordTokenizer does no actual tokenizing, so the entire
            input string is preserved as a single token
         -->
       <tokenizer class="solr.KeywordTokenizerFactory"/>
<!-- The LowerCase TokenFilter does what you expect, which can be
            when you want your sorting to be case insensitive
         -->
       <filter class="solr.LowerCaseFilterFactory" />
<!-- The TrimFilter removes any leading or trailing whitespace -->
       <filter class="solr.TrimFilterFactory" />
       <!-- The PatternReplaceFilter gives you the flexibility to use
Java Regular expression to replace any sequence of characters
            matching a pattern with an arbitrary replacement string,
which may include back references to portions of the original
            string matched by the pattern.

            See the Java Regular Expression documentation for more
            information on pattern and replacement string syntax.

            
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
         -->
       <filter class="solr.PatternReplaceFilterFactory"
               pattern="([^a-z])" replacement="" replace="all"
       />
     </analyzer>
   </fieldType>


When I sort it using titles that are alphanumeric it works great, but if the titles start with numbers, it almost seems random. Any suggestions?

thanks
Joel


Reply via email to