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

You cannot sort on fields that don't exist

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.9
    • core/search
    • None
    • Operating System: other
      Platform: Other

    • 34477

    Description

      While it's possible to search for fields that don't exist (you'll get 0 hits),
      you'll get an exception if you try to sort by a field that has no values. The
      exception is this:

      if (termEnum.term() == null) {
      throw new RuntimeException ("no terms in field " + field);
      }

      I'll attach a change suggested by Yonik Seeley that removes this exception.

      Also, the if-condition above is incomplete anyway, so currently the exception
      is not always thrown (as termEnum .term() might well be != null but point to a
      term in a different field already)

      Attachments

        1. sort.diff
          10 kB
          Yonik Seeley
        2. sort.diff
          3 kB
          Yonik Seeley
        3. ASF.LICENSE.NOT.GRANTED--sort.diff
          0.8 kB
          Daniel Naber

        Issue Links

          Activity

            People

              yseeley@gmail.com Yonik Seeley
              daniel.naber@t-online.de Daniel Naber
              Votes:
              4 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: