Reputation: 1145
Am using the below solr query which works
https://host:port/solr/ref_cm/select?defType=edismax&q=abc&qf=a+b+c+d
May I know how to set the same using solrj. I tried below with "qf" but it doesnt work (even though from url it works)
final Map<String, String> queryParamMap = new HashMap<String, String>();
queryParamMap.put("q", query);
queryParamMap.put("defType", "edismax");
queryParamMap.put("qf","a, b, c, d");
Appreciate any pointers
Upvotes: 2
Views: 302
Reputation: 8658
You can try below part of the code. it should work for you.
The code queryParamMap.put("qf", "a b c d")
would work instead of queryParamMap.put("qf","a, b, c, d")
.
The full code would be something like below.
ModifiableSolrParams queryParamMap= new ModifiableSolrParams();
queryParamMap.set("q", "test");
queryParamMap.set("defType", "edismax");
queryParamMap.set("qf", "a b c d");
QueryResponse qResp = cloudSolrClient.query(queryParamMap);
SolrDocumentList docList = qResp.getResults();
int numFound = (int) docList.getNumFound();
Upvotes: 3