lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <j...@basetechnology.com>
Subject Re: How to sort value that numeric mix alpha
Date Sun, 29 Jun 2014 15:03:28 GMT
I think you wanted to remove letters, but your pattern removes NON-letters - 
that's what the "^" does, negation.

So, try: ="[a-z]".

You can also get rid of the lower case filter and just use "[a-zA-Z]".

-- Jack Krupansky

-----Original Message----- 
From: rachun
Sent: Sunday, June 29, 2014 3:19 AM
To: solr-user@lucene.apache.org
Subject: How to sort value that numeric mix alpha

Dear all,

Could anybody suggest me how to sort the field that has numeric mix with
alpha.
In my case I have field name 'product_id' which contain value  like
C1,C2,C3,C4,C9,C12,C23,C50

when I try to sort (DESC) it return wrong result something like this
C9,C50,C4,C3,C23,C2,C12,C1

As you see I have 'C' for prefix.

So, In my Schema.xml I have tried this...

   <fieldType name="alphaOnlySort" class="solr.TextField"
sortMissingLast="true" omitNorms="true">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.TrimFilterFactory" />
        <filter class="solr.PatternReplaceFilterFactory"
                pattern="([^a-z])" replacement="" replace="all"
        />
      </analyzer>
    </fieldType>

<field name="pid_sort" type="alphaOnlySort" indexed="true" stored="true" />

<copyField source="product_id" dest="pid_sort"/>

but it didn't work. How to deal with this?

Thank you very much,
Chun.







--
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-sort-value-that-numeric-mix-alpha-tp4144615.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Mime
View raw message