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

FieldCacheSource (or it's subclasses) should override getSortField

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.3, 6.0
    • None
    • None
    • New

    Description

      ValueSource defines the following method...

        public SortField getSortField(boolean reverse) {
          return new ValueSourceSortField(reverse);
        }
      

      ...where ValueSourceSortField builds up a ValueSourceComparator containing a double[] based on the FunctionValues of the original ValueSource.

      meanwhile, the abstract FieldCacheSource exists as a base implementation for classes like IntFieldSource and DoubleFieldSource which wrap a ValueSource around DocValues for the specified field.

      But neither FieldCacheSource nor any of it's subclasses override the getSortField(boolean) method – so attempting to sort on something like an IntFieldSource winds up using a bunch of ram to build that double[] to give users a less accurate sort (because of casting) then if they just sorted directly on the field.

      is there any good reason why FieldCacheSource subclases like IntFieldSource shouldn't all override getSortField with something like...

        public SortField getSortField(boolean reverse) {
          return new SortField(field, Type.INT, reverse);
        }
      

      ?

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            hossman Chris M. Hostetter
            hossman Chris M. Hostetter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment