[
https://issues.apache.org/jira/browse/SOLR-11437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16191570#comment-16191570
]
Hoss Man commented on SOLR-11437:
---------------------------------
straw man idea: a new static helper utility in FieldType that takes the same
args as {{getRangeQuery(..)}} that returns an "exist" query if and only if it's
applicable for the given field,lower,upper,inclusion args -- else returns null.
impls of {{getRangeQuery(..)}} could call this method as their first line, and
return the result if non null -- else continue processing.
{noformat}
public Query getRangeQuery(QParser parser, SchemaField field, String part1,
String part2, boolean minInclusive, boolean maxInclusive) {
Query simpleExists = getExistsQueryIfApplicable(parser, field, part1, part2,
minInclusive, maxInclusive);
if (null != simpleExists) {
return simpleExists;
}
// existing method body
}
public static Query getExistsQueryIfApplicable(QParser parser, SchemaField
field, String part1, String part2, boolean minInclusive, boolean maxInclusive) {
if (null != part1 || null != part2 || !minInclusive || !maxInclusive) {
return null;
}
if (field.hasDocValues()) {
// ...
}
// ...else check norms
// else return null
{noformat}
> double open ended range queries should be optimized to
> DocValuesFieldExistsQuery or NormsFieldExistsQuery
> ---------------------------------------------------------------------------------------------------------
>
> Key: SOLR-11437
> URL: https://issues.apache.org/jira/browse/SOLR-11437
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Hoss Man
>
> DocValuesFieldExistsQuery & NormsFieldExistsQuery are efficient ways to
> determine if a doc has a value in a given field (assuming the field has
> docValues or norms respectively)
> Since Solr's schema knows if/when these properties are true for a given
> field, we should be able to optimize some of the {{field:[* TO *]}} usecases
> to use these queries under the covers -- notably in
> {{FieldType.getRangeQuery}} and subclasses that override it, but there may be
> other cases where they could come in handy as well
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]