Hi Alek,
On 10/13/2008 at 8:29 PM, Aleksandar Bradic wrote:
> For custom faceting of numerical fields (and similar
> applications), it would be super-useful if the list of
> terms for each numerical field in the index (accessible
> via FieldCache.StringIndex.lookup), could be stored in
> numerical rather than "natural" (alphabetical) order.
>
> [...]
>
> Any ideas on how to achieve something similar ?
> (normalizing numerical to alphabetical values, by prepending
> zeroes in 12 -> 0000012 manner :) would definitely be one) :)
Are you aware of Solr's SortableIntField and friends? From Solr's example
schema.xml:
<!-- Numeric field types that manipulate the value into
a string value that isn't human-readable in its internal form,
but with a lexicographic ordering the same as the numeric ordering,
so that range queries work correctly. -->
<fieldType name="sint" class="solr.SortableIntField"
sortMissingLast="true" omitNorms="true"/>
<fieldType name="slong" class="solr.SortableLongField"
sortMissingLast="true" omitNorms="true"/>
<fieldType name="sfloat" class="solr.SortableFloatField"
sortMissingLast="true" omitNorms="true"/>
<fieldType name="sdouble" class="solr.SortableDoubleField"
sortMissingLast="true" omitNorms="true"/>
Steve