Search in sources :

Example 11 with MultiMapSolrParams

use of org.apache.solr.common.params.MultiMapSolrParams in project lucene-solr by apache.

the class LocalSolrQueryRequest method makeParams.

protected static SolrParams makeParams(String query, String qtype, int start, int limit, Map args) {
    Map<String, String[]> map = new HashMap<>();
    for (Iterator iter = args.entrySet().iterator(); iter.hasNext(); ) {
        Map.Entry e = (Map.Entry) iter.next();
        String k = e.getKey().toString();
        Object v = e.getValue();
        if (v instanceof String[])
            map.put(k, (String[]) v);
        else
            map.put(k, new String[] { v.toString() });
    }
    if (query != null)
        map.put(CommonParams.Q, new String[] { query });
    if (qtype != null)
        map.put(CommonParams.QT, new String[] { qtype });
    map.put(CommonParams.START, new String[] { Integer.toString(start) });
    map.put(CommonParams.ROWS, new String[] { Integer.toString(limit) });
    return new MultiMapSolrParams(map);
}
Also used : MultiMapSolrParams(org.apache.solr.common.params.MultiMapSolrParams) HashMap(java.util.HashMap) Iterator(java.util.Iterator) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

MultiMapSolrParams (org.apache.solr.common.params.MultiMapSolrParams)11 HashMap (java.util.HashMap)9 ContentStream (org.apache.solr.common.util.ContentStream)7 ArrayList (java.util.ArrayList)6 SolrCore (org.apache.solr.core.SolrCore)4 SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)4 Test (org.junit.Test)4 IOException (java.io.IOException)3 Map (java.util.Map)3 UpdateRequestHandler (org.apache.solr.handler.UpdateRequestHandler)3 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)3 BufferedInputStream (java.io.BufferedInputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 LinkedHashMap (java.util.LinkedHashMap)2 ServletInputStream (javax.servlet.ServletInputStream)2 SolrException (org.apache.solr.common.SolrException)2 SolrParams (org.apache.solr.common.params.SolrParams)2 ContentStreamBase (org.apache.solr.common.util.ContentStreamBase)2 LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)2