Skip to content
scampi edited this page Oct 11, 2011 · 2 revisions

Support of MultiTermQuery in Siren QParser

SirenNumericRangeQuery builder

The syntax to write a numeric query is

  FIELD_NAME:[xxx to yyy]

The character '[' stands for the left bound inclusion, whereas ']' stands for the right bound inclusion. The characters '{' and '}' are respectfully used for left and right exclusion.

In Lucene, numeric queries are performed on a special NumericField; "FIELD_NAME" is that field's name and is used as a mapping to a NumericConfig. This latter class sets how query bounds, and so the field, are supposed to be interpreted: as integers, as floats, with which precision, ....

However, in SIREn, this query is run within a text field. Therefore the FIELD_NAME cannot be used to map to a NumericConfig. Instead, we use an arbitrary name to identify how the range is interpreted. This mapping is defined in org.sindice.siren.qparser.ntriple.query.ResourceQueryParser. Another consequence is that in SirenNumericRangeQuery.termCompare() method, the field name of a term cannot be used to compare against a term of the siren field.