lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Beaumont <>
Subject Range Query question
Date Thu, 30 Jul 2009 12:41:15 GMT


I have a set of XML data that holds Minimum and Maximum values and I need to
be able to do specific range queries against them.

(Note that this is a contrived example, and that in reality the garage would
probably hold all the individual prices of all its cars, but this is
analogous to the problem we have which is couched in terms that would
obscure the problem.)

For example, the following XML fragment is indexed so that each <car>
element becomes a Solr document:


I want to be able do a range query where
  search min value = 2500
  search max value = 3500

This should return garage1 as potentially having cars in my price range as
the range of prices for the garage contains the range I have input.  It's
also worth noting that we can't simply look for min prices that fall inside
our range or max prices that fall inside our range, as in the case outlined
above, none of the individual values fall inside our range, but there is

The problem is that the indexed form of this XML is flattened so the <car>
entity has 2 garage names, 2 min values and 2 max values, but the grouping
between the garage name and it's min and max values is lost.  The danger is
that we end up doing a comparison of the min-of-the-mins and the
max-of-the-maxes, which tells us that a car is available in the price range
which may not be true if garage1 has all cars below our search range and
garage2 has all cars above our search range, e.g. if our search range is
5000-6000 then we should get no match.

We wanted to include the garage name as an attritube of the min/max values
to maintain this link, but couldn't find a way to do this.

Finally, it would be extremely difficult for us to modify the XML presented
to our system, hence our approach to date.

Has anyone had a similar problem and if so how did you overcome it?

Thanks for taking the time to look.

Matt Beaumont

View this message in context:
Sent from the Solr - User mailing list archive at

View raw message