It really depends upon how clever you want to be.

If I were to do it, I would push two versions into Solr, one with MB or
GB in, for display, and another, resolved to a number, for faceting and
querying. I.e do the work outside Solr.

If you did want to be clever, you could use a KeywordTokenizer in an
analysis chain (it spits out just a single token) and then write your
own UnitResolvingFilterFactory, which you could configure with mapping
so such as KB->1024, and spits out integer or float fields.

This should then work for querying, as querystring terms would be
analysed. It would be neat because the stored.field values would include
the pretty units, whilst the indexed values would be pure numbers. You
could use the field for range faceting, but you would get the indexed
value, I.e. Without the units, as faceting uses the indexed value not
the stored one.

Upayavira

On Mon, Nov 11, 2013, at 02:49 AM, eakarsu wrote:
> I would like to have a SOLR field that has multiple unit of dimension.
> Suppose we store the memory value of a computer in solr field. That can
> have
> value 256 MB, 512 MB, or 1 GB where we use MB and GB units. Same case is
> for
> hard drive sizes : 256 MB,50GB or 3TB where we use MB,GB and TB units.
> 
> How can I store these unit of dimensions with values itself? I would like
> to
> have range queries on such fields: say bring me desktops that has 256M-1G
> memory values.
> 
> I appreciate any guidance
> 
> Thanks
> 
> Erol Akarsu
> 
> 
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Unit-of-dimension-for-solr-field-tp4100209.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to