> 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.
You could index each garage-car pairing as a separate document, embedding all the necessary information you need for searching. e.g.- <garage_car> <car_manufacturer>Ford</manufacturer> <car_model>Ka</model> <garage_name>garage1</name> <min>2000</min> <max>4000</max> </garage_car>