gerlowskija opened a new pull request, #4141: URL: https://github.com/apache/solr/pull/4141
https://issues.apache.org/jira/browse/SOLR-13309 # Description Lucene offers a variety of 'Range' field types, where the value stored in the field is itself a range (e.g. `[1 TO 5]`). Lucene then allows efficient search on these using its `RangeFieldQuery`. Solr offers no similar functionality, despite having access to these underlying Lucene capabilities. We should expose start exposing these, starting with what's probably the most popular option, ints. # Solution This commit adds a new field type, IntRangeField, that can be used to hold singular or multi-dimensional (up to 4) ranges of integers. Field values are represented using brackets and the "TO" operator, with commas used to delimit dimensions (when a particular field is defined as having more than 1 dimension), e.g. - [-1 TO 5] - [1,2 TO 5,10] - [1 TO 1] IntRangeField does not support docValues or uninversion, meaning it's primarily only used for querying. The field can be stored and returned in search-results. Searches on these range-fields mostly rely on a QParser, {!myRange}, which supports "intersects", "crosses", "within", and "contains" semantics via a "criteria" local param. e.g. - {!myRange field=price_range criteria=within}[1 TO 5] Matches docs whose 'price_range' field falls fully within [1 TO 5]. A doc with [2 TO 3] would match; [3 TO 6] or [8 TO 10] would not. - {!myRange field=price_range criteria=crosses}[1,10 TO 5,20] Matches docs whose 'price_range' field is partially but not fully contained within [1,10 TO 5,20]. A doc with [2,11 TO 6,21] would match, but [3,11 TO 5,19] would not. TODO - renaming of QParser, 'myRange' stinks - general cleanup - switch around 'external', 'internal', 'native' representations. - make IntRangeQparserPlugin more generic, in order to handle other types of ranges in the future. # Tests New test classes: IntRangeFieldTest and IntRangeQParserPluginTest. # Checklist Please review the following and check all that apply: - [ ] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability. - [ ] I have created a Jira issue and added the issue ID to my pull request title. - [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation) - [ ] I have developed this patch against the `main` branch. - [ ] I have run `./gradlew check`. - [ ] I have added tests for my changes. - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide) - [ ] I have added a [changelog entry](https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc) for my change -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
