Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-1857

Change NumericRangeQuery to generics (for the numeric type)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New

      Description

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

      1. LUCENE-1857.patch
        22 kB
        Uwe Schindler
      2. LUCENE-1857.patch
        50 kB
        Uwe Schindler

        Issue Links

          Activity

          Hide
          thetaphi Uwe Schindler added a comment -

          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.

          Show
          thetaphi Uwe Schindler added a comment - 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.
          Hide
          thetaphi Uwe Schindler added a comment -

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

          Show
          thetaphi Uwe Schindler added a comment - Updated patch with tests generified and also using autoboxing in javadocs and test code.
          Hide
          thetaphi Uwe Schindler added a comment -

          Added CHANGES.txt an committed revision: 820792

          Show
          thetaphi Uwe Schindler added a comment - Added CHANGES.txt an committed revision: 820792

            People

            • Assignee:
              thetaphi Uwe Schindler
              Reporter:
              thetaphi Uwe Schindler
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development