[ 
https://issues.apache.org/jira/browse/SOLR-6540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hoss Man updated SOLR-6540:
---------------------------
    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.

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

  was:
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.

{code}
THIS:           if(exists(foo),strdist("literal",field_name_s,edit),0)
INSTEAD OF:     strdist("literal",field_name_s,edit)
{code}


> strdist() causes NPE if doc is missing field
> --------------------------------------------
>
>                 Key: SOLR-6540
>                 URL: https://issues.apache.org/jira/browse/SOLR-6540
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Hoss Man
>             Fix For: 5.0, Trunk
>
>         Attachments: SOLR-6540.patch
>
>
> 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.
> {code}
> THIS:           
> if(exists(field_name_s),strdist("literal",field_name_s,edit),0)
> INSTEAD OF:     strdist("literal",field_name_s,edit)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to