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

strdist() causes NPE if doc is missing field

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Issue Links

        Activity

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

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment