Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-6540

strdist() causes NPE if doc is missing field

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      If you try to use the strdist function on a field which is missing in some docs, you'll get a NullPointerException

      A workarround in some contexts can be to wrap the strdist function in an "if" that checks exists(fieldname) and returns some suitable default if it's not found.

      THIS:           if(exists(field_name_s),strdist("literal",field_name_s,edit),0)
      INSTEAD OF:     strdist("literal",field_name_s,edit)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                hossman Hoss Man
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: