Lucene - Core
  1. Lucene - Core
  2. LUCENE-374

You cannot sort on fields that don't exist

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9
    • Component/s: core/search
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      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)

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

        Issue Links

          Activity

          Steve Rowe made changes -
          Affects Version/s CVS Nightly - Specify date in submission [ 12310282 ]
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12564495 ] jira [ 12585755 ]
          Mark Thomas made changes -
          Workflow jira [ 12324529 ] Default workflow, editable Closed status [ 12564495 ]
          steve neo made changes -
          Link This issue is cloned as LUCENE-1631 [ LUCENE-1631 ]
          Daan de Wit made changes -
          Link This issue is related to LUCENE-916 [ LUCENE-916 ]
          Doug Cutting made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Yonik Seeley made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.9 [ 12310334 ]
          Assignee Lucene Developers [ java-dev@lucene.apache.org ] Yonik Seeley [ yseeley@gmail.com ]
          Resolution Fixed [ 1 ]
          Yonik Seeley made changes -
          Link This issue is cloned as LUCENE-459 [ LUCENE-459 ]
          Yonik Seeley made changes -
          Attachment sort.diff [ 12314602 ]
          Yonik Seeley made changes -
          Attachment sort.diff [ 12314601 ]
          Jeff Turner made changes -
          Field Original Value New Value
          issue.field.bugzillaimportkey 34477 12314524
          Daniel Naber created issue -

            People

            • Assignee:
              Yonik Seeley
              Reporter:
              Daniel Naber
            • Votes:
              4 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development