the problem you're running into is that lexical ordering of
numeric data != numeric ordering. If you have a mixed
alpha and numeric data, you man not care if the alpha
stuff is first, i.e.

asdb456
asdf490

sorts fine. Problems happen with
9jsdf
100ukel

the 100ukel comes first.

So if you have a mixed alpha and numeric situation,
you have to either live with it or normalize the numeric
data so it lexical ordering == numeric ordering, the most
common way is to left-pad numeric data to a fixed-width,
i.e. rather than index asb9fg, index asb0000009fg. Of
course you have to know what the upper limit of any digit
is for this to work...

Best
Erick

On Wed, Aug 15, 2012 at 12:33 AM, Aleksander Akerø
<solraleksan...@gmail.com> wrote:
> Oh brilliant, didn't think of it being possible to configure that way.
>
> Had made my own "untokenized" type, so I guess it would be better for me to
> control datatype this way.
>
> Bonus question (hehe): What if these field values also contain alphanumeric
> values? E.g. "Alpha, Bravo, Omega, ... "
> How would this affect the sorting? I guess the TrieIntField is not
> applicable then.
>
> Aleksander Akerø
> @ Gurusoft AS
> Mobil: 944 89 054
> QR-Code (Kontaktinfo)
>
> -----Original Message-----
> From: Chris Hostetter [mailto:hossman_luc...@fucit.org]
> Sent: 14. august 2012 17:45
> To: solr-user@lucene.apache.org
> Subject: Re: Facet sort numeric values
>
>
> : I'm having a problem with sorting facets. I am using the facet.sort=index
> : parameter and it works fine for most of the values.
>         ...
> : Eksample, when sorting "15, 6, 23, 7, 10, 90" it sorts like this: "10, 15,
> : 23, 6, 7, 90", but what I wanted was "6, 7, 10, 15, 23, 90".
>
> what field type are you using?
>
> If you use one of the Trie___Field types then the facet values should sort
> exactly as you describe.
>
> <fieldType name="int" class="solr.TrieIntField" precisionStep="0"
> positionIncrementGap="0"/> <fieldType name="float"
> class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
> <fieldType name="long" class="solr.TrieLongField" precisionStep="0"
> positionIncrementGap="0"/> <fieldType name="double"
> class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
>
>
>
> -Hoss
>

Reply via email to