You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Peter Kirk <pk...@alpha-solutions.dk> on 2013/09/23 21:08:53 UTC

SolrParams to and from NamedList

Hi,

In a request-handler, if I run the below code, I get an exception from Solr
undefined field: "[Ljava.lang.String;@41061b68"

It appears the conversion between SolrParams and NamedList and back again fails if one of the parameters is an array. This could be a couple of configuration parameters like
<str name="facet.field">category</str>
<str name="facet.field">author</str>


public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {

  SolrParams params = req.getParams();
  NamedList parameterList = params.toNamedList();
  SolrParams newSolrParams = SolrParams.toSolrParams(parameterList);

  req.setParams(newSolrParams);
  super.handleRequestBody(req, rsp);


How can I generate the correct conversion?

Thanks.

RE: SolrParams to and from NamedList

Posted by Peter Kirk <pk...@alpha-solutions.dk>.
Hi - I think there is a bug in the conversion methods for SolrParams. But it seems that using ModifiableSolrParams (to add and remove parameters and values, which is what I want to do), is the way to go.

/Peter


-----Original Message-----
From: Peter Kirk [mailto:pk@alpha-solutions.dk] 
Sent: 23. september 2013 21:09
To: solr-user@lucene.apache.org
Subject: SolrParams to and from NamedList

Hi,

In a request-handler, if I run the below code, I get an exception from Solr undefined field: "[Ljava.lang.String;@41061b68"

It appears the conversion between SolrParams and NamedList and back again fails if one of the parameters is an array. This could be a couple of configuration parameters like <str name="facet.field">category</str> <str name="facet.field">author</str>


public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {

  SolrParams params = req.getParams();
  NamedList parameterList = params.toNamedList();
  SolrParams newSolrParams = SolrParams.toSolrParams(parameterList);

  req.setParams(newSolrParams);
  super.handleRequestBody(req, rsp);


How can I generate the correct conversion?

Thanks.