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

strdist() causes NPE if doc is missing field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0, 6.0
    • None
    • 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

        1. SOLR-6540.patch
          4 kB
          Chris M. Hostetter

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: