Hi,

I'm getting confused about the method Map<String,String[]>
toMultiMap(NamedList params) in SolrParams class.
When some of your parameter is instanceof String[] it's converted to to
String using the toString() method, which seems
to me to be wrong. It is probably assuming, that the values in NamedList are
all String, but when you look at the method
toNamedList() it's clearly adding String[] in case that the parameter has
more than one value.
So my question is, wheater it is a bug or I'm getting something wrong.


public static Map<String,String[]> toMultiMap(NamedList params) {
    HashMap<String,String[]> map = new HashMap<String,String[]>();
    for (int i=0; i<params.size(); i++) {
      String name = params.getName(i);
      String val = params.getVal(i).toString();
      MultiMapSolrParams.addParam(name,val,map);
    }
    return map;
  }


public NamedList toNamedList() {
    final SimpleOrderedMap result = new SimpleOrderedMap();
           
    for(Iterator<String> it=getParameterNamesIterator(); it.hasNext(); ) {
      final String name = it.next();
      final String [] values = getParams(name);
      if(values.length==1) {
           result.add(name,values[0]);
      } else {
          // currently no reason not to use the same array
          result.add(name,values);
      }
    }
    return result;
  }


Cheers

Hana
-- 
View this message in context: 
http://www.nabble.com/Method-toMultiMap%28NamedList-params%29-in-SolrParams-tp21626588p21626588.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to