You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Yonik Seeley <yo...@lucidimagination.com> on 2009/09/17 22:30:01 UTC

Re: Facet query throws NullPointerException when the facetqueries response is null in QueryResponse object

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 <gu...@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.
>
>

Re: Facet query throws NullPointerException when the facetqueries response is null in QueryResponse object

Posted by jrduncans <st...@gmail.com>.
As I understand it, the problem was occurring when there was an error parsing
the facet-query, then a NullPointerException was resulting.  I'll be
updating our code to the latest trunk soon (and hopefully to 1.4 final soon
after) to verify that the problem is fixed.


Yonik Seeley-2 wrote:
> 
> 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
> 
> 

-- 
View this message in context: http://www.nabble.com/Facet-query-throws-NullPointerException-when-the-facetqueries-response-is-null-in-QueryResponse-object-tp25492240p25617752.html
Sent from the Solr - Dev mailing list archive at Nabble.com.