If your ranges are always contiguous, you could index two fields: range-start and range-end and then perform queries like:

range-start:[* TO 30] AND range-end:[5 TO *]

If you have multiple ranges which could have gaps in between then you need something more complicated :)

On 02/27/2012 04:09 PM, federico.wachs wrote:
Hi all !

Here's my dreadful case, thank you for helping out! I want to have a
document like this:

<doc>
     ...
     <arr name="occupiedDays">  -- multivalued range field
          <range>1 TO 10</range>
          <range>5 TO 15</range>
     </arr>
     ...
</doc>
And the reason why I want to do this is because it's so much lighter than
having all the numbers in there, of course. Just to be clear, I want to
avoid having this in solr:

<doc>
     ...
     <arr name="occupiedDays">  -- multivalued range field
          <str>1</str>
          <str>2</str>
          <str>3</str>
          <str>4</str>
          <str>5</str>
          <str>6</str>
          <str>7</str>
          <str>8</str>
          <str>9</str>
          <str>10</str>
     </arr>
     ...
</doc>
And then perform range queries on this range field like: fq=-occupiedDays:[5
TO 30]

Anybody has any idea? I have asked and searched all over the internet and
seems solr does not support this.

Any help would be really helpful! Thanks in advanced.

Federico

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Is-there-a-way-to-implement-a-IntRangeField-in-Solr-tp3782083p3782083.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to