我在我的Solr存储库类中定义了一个@Highlight查询,它返回了有趣的' snipplets' info,如果我从另一个类/控制器调用它。但是,如果我通过@RepositoryRestResource公开的隐式休息服务(例如http://localhost:8080/modules/search/findByDescriptionContaining?description=maths)访问该方法,它根本不会返回任何突出显示/ snipplet信息
@RepositoryRestResource
interface ModuleRepository extends SolrCrudRepository<Module, String>{
@Highlight(prefix = "<b>", postfix = "</b>")
HighlightPage<Module> findByDescriptionContaining(@Param(value = "description") String description, Pageable pageable)
}
所以回顾一下,调用auto exposed方法会返回:
{
"_embedded" : {
"modules" : [ {
"name" : "science",
"description" : "a somewhat scientific course with some maths",
"_links" : {
"self" : {
"href" : "http://localhost:8080/modules/102"
},
"module" : {
"href" : "http://localhost:8080/modules/102"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/modules/search/findByDescriptionContaining?description=maths"
}
},
"page" : {
"size" : 20,
"totalElements" : 1,
"totalPages" : 1,
"number" : 0
}
}
如何使用上述方法获取突出显示信息?