java - solrj 设置查询字段
问题描述
我正在使用以下有效的 solr 查询
https://host:port/solr/ref_cm/select?defType=edismax&q=abc&qf=a+b+c+d
我可以知道如何使用 solrj 进行设置。我在下面尝试了“qf”,但它不起作用(即使从 url 它可以工作)
final Map<String, String> queryParamMap = new HashMap<String, String>();
queryParamMap.put("q", query);
queryParamMap.put("defType", "edismax");
queryParamMap.put("qf","a, b, c, d");
感谢任何指针
解决方案
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();
推荐阅读
- numpy - Pytorch 内存模型:“torch.from_numpy()”如何工作?
- postgresql - Postgres 复制数据目录后某些表无法正常工作
- javascript - 获取 api 和代理
- django - django中使用三个js的3d模型路径
- javascript - 如何使用 JavaScript 替换表单操作的基本 url?
- python-3.x - 为什么每个数据框的格式不按日期更改?
- google-sheets - 如何计算谷歌表格中绿色的单元格
- python - 如何在其他python文件中附加特定列表并保存
- javascript - Angular 组件通信
- azure-cosmosdb - 何时不使用 Azure Cosmos DB 批量执行程序?