lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: Facet query throws NullPointerException when the facetqueries response is null in QueryResponse object
Date Thu, 17 Sep 2009 20:30:01 GMT
I committed this change, just for defensive purposes...
but why is facet_queries coming back null for you?  I thought it was
always added when facet=true.

-Yonik
http://www.lucidimagination.com



On Thu, Sep 17, 2009 at 3:49 PM, Raju444us <gudipallyn@gmail.com> wrote:
>
>
> The extractFacetInfo(...)  method of QueryResponse object throws
> NullPointerExcpetion when the facetQueries are null.
>
> The code in bold  will throw NullPointerException if the fq param is null.
>
>    // Parse the queries
>    _facetQuery = new HashMap<String, Integer>();
>    NamedList<Integer> fq = (NamedList<Integer>) info.get( "facet_queries"
> );
>    for( Map.Entry<String, Integer> entry : fq ) {
>      _facetQuery.put( entry.getKey(), entry.getValue() );
>    }
>
> the patch for this is
>
>    // Parse the queries
>    _facetQuery = new HashMap<String, Integer>();
>    NamedList<Integer> fq = (NamedList<Integer>) info.get( "facet_queries"
> );
> if(fq!= null)
> {
> for( Map.Entry<String, Integer> entry : fq ) {
>      _facetQuery.put( entry.getKey(), entry.getValue() );
>    }
> }
> --
> View this message in context: http://www.nabble.com/Facet-query-throws-NullPointerException-when-the-facetqueries-response-is-null-in-QueryResponse-object-tp25492240p25492240.html
> Sent from the Solr - Dev mailing list archive at Nabble.com.
>
>

Mime
View raw message