spring - 自定义 SOLR 默认响应到自定义搜索响应
问题描述
我正在研究使用 Spring Boot 通过微服务访问 solr 的 POC。我正在使用 Rest 模板连接 solr 。我的查询是我们可以自定义 solr 返回的响应吗?
例如:
solrUri="http://localhost:8983/solr/microServicesPOC/select?q= : &wt=json"
当我们访问上面的 url 时,solr 返回的响应有字段的文档。我需要以我的 Product pojo 格式获取结果。
片段:
resEntity = solrConfig.getRestTemplate().exchange(solrUri,HttpMethod.POST,entity, Product.class);
要从上面的 rest 模板方式实现,我需要 solr 以 Product 格式返回响应。SOlr 有可能吗?
我没有使用 solrTemplate 或 solrJ。我希望从 solr 方面而不是在服务方面进行定制。
尝试自定义 searchHandler ,编写 DocTransformer 但没有一个方法有效。
解决方案
推荐阅读
- python - 使用 Google Sheet 公式计算归一化分数
- java - 如何在Android中创建一个实例来调用一个活动的方法到一个服务类?
- php - 单个 MySQL 列中的首选项列表
- docker - 将环境变量添加到包含以下内容的 Docker 文件中:
- ansible - 有没有办法在 Ansible 中显示已注册的处理程序或侦听器?
- rendering - 我们可以根据到相机的距离来控制 Viewer 中的渐进式渲染吗?
- java - 线程在终止之前不会输出流
- c++ - 使用 g++ 编译包含根库的 c++
- javascript - 节点获取映射错误 - 无法读取未定义的属性“映射””
- javascript - 如何点击div下的元素?