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

DocValues cleanup: constructor & getInnerArray()

    Details

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

      Description

      DocValues constructor taking a numDocs parameter is not very clean.
      Get rid of this.

      Also, it's optional getInnerArray() method is not very clean.
      This is necessary for better testing, but currently tests will fail if it is not implemented.
      Modify it to throw UnSupportedOp exception (rather than returning an empty array).
      Modify tests to not fail but just warn if the tested iml does not override it.

      These changes should make it easier to implement DocValues for other ValueSource's, e.g. above payloads, with or without caching.

        Activity

        Hide
        doronc Doron Cohen added a comment -

        In this patch:

        • default getInnerArray throws (UnsupportedOperationException
        • only warn if tested DocValues.getInnerArray() throws this exception but other than that test passes
        • constructor does not need numDocs arg
        • optional iteration on values to compute average etc. just loops until catching ArrayIndexOutOfBoundsException.

        All search.function tests pass.

        Show
        doronc Doron Cohen added a comment - In this patch: default getInnerArray throws (UnsupportedOperationException only warn if tested DocValues.getInnerArray() throws this exception but other than that test passes constructor does not need numDocs arg optional iteration on values to compute average etc. just loops until catching ArrayIndexOutOfBoundsException. All search.function tests pass.
        Hide
        doronc Doron Cohen added a comment -

        Committed.

        Show
        doronc Doron Cohen added a comment - Committed.

          People

          • Assignee:
            doronc Doron Cohen
            Reporter:
            doronc Doron Cohen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development