apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.6k stars 1.01k forks source link

Change NumericRangeQuery to generics (for the numeric type) [LUCENE-1857] #2932

Closed asfimport closed 14 years ago

asfimport commented 15 years ago

NumericRangeQuery/Filter can use generics for more type-safety: NumericRangeQuery<T extends Number>


Migrated from LUCENE-1857 by Uwe Schindler (@uschindler), resolved Oct 01 2009 Attachments: LUCENE-1857.patch (versions: 2) Linked issues:

asfimport commented 14 years ago

Uwe Schindler (@uschindler) (migrated from JIRA)

Patch that adds generics: After thinking about it the whole night: The "static ctors" cannot be removed, because even with generics there is not type safety. The private ctor needs the valSize information, to choose the right term encoding. This could theoretically be determined by instanceof checks, but would not work, if you use null for both upper and lower bounds. This generified version is easier to handle, because it returns the correct type when calling getMin()/getMax(). It also uses generics for its collections api usage.

asfimport commented 14 years ago

Uwe Schindler (@uschindler) (migrated from JIRA)

Updated patch with tests generified and also using autoboxing in javadocs and test code.

asfimport commented 14 years ago

Uwe Schindler (@uschindler) (migrated from JIRA)

Added CHANGES.txt an committed revision: 820792