首页 > 解决方案 > 自定义 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 但没有一个方法有效。

标签: springspring-bootsolrspring-data-solr

解决方案


推荐阅读