You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Yonik Seeley (Resolved) (JIRA)" <ji...@apache.org> on 2012/02/21 21:54:48 UTC

[jira] [Resolved] (SOLR-3150) NPE when facetting using facet.prefix on an "empty" field

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

Yonik Seeley resolved SOLR-3150.
--------------------------------

    Resolution: Fixed

Fix committed.  Thanks Pablo!
                
> NPE when facetting using facet.prefix on an "empty" field
> ---------------------------------------------------------
>
>                 Key: SOLR-3150
>                 URL: https://issues.apache.org/jira/browse/SOLR-3150
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.0
>            Reporter: Pablo Queixalos
>            Assignee: Yonik Seeley
>             Fix For: 4.0
>
>
> FacetComponent works fine on empty fields but crashes if facet.prefix parameter is set.
> Looking at the code : getOrdTermsEnum(..) returns null if no value is found on the field but _getCounts(...)_ does not checks if _TermsEnum te_ is null or not.
> {code:java|title=UnInvertedField.java (getCounts(..))}
>       TermsEnum te = getOrdTermsEnum(searcher.getAtomicReader());
>       if (prefix != null && prefix.length() > 0) {
>         final BytesRef prefixBr = new BytesRef(prefix);
> 232:    if (te.seekCeil(prefixBr, true) == TermsEnum.SeekStatus.END) {
>           startTerm = numTermsInField;
>         } else {
>           startTerm = (int) te.ord();
>         }
>         prefixBr.append(UnicodeUtil.BIG_TERM);
>         if (te.seekCeil(prefixBr, true) == TermsEnum.SeekStatus.END) {
>           endTerm = numTermsInField;
>         } else {
>           endTerm = (int) te.ord();
>         }
>       }
> {code}
> {code}
> java.lang.NullPointerException
> 	at org.apache.solr.request.UnInvertedField.getCounts(UnInvertedField.java:232)
> 	at org.apache.solr.request.SimpleFacets.getTermCounts(SimpleFacets.java:299)
> 	at org.apache.solr.request.SimpleFacets.getFacetFieldCounts(SimpleFacets.java:354)
> 	at org.apache.solr.request.SimpleFacets.getFacetCounts(SimpleFacets.java:207)
> 	at org.apache.solr.handler.component.FacetComponent.process(FacetComponent.java:81)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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