2

I have defined a @Highlight query on my Solr repository class which returns the interesting 'snipplets' info if I call it from another class/controller. However if I access the method through the implicit rest service exposed via @RepositoryRestResource ( e.g. http://localhost:8080/modules/search/findByDescriptionContaining?description=maths ) , it doesn't return any highlighting/snipplet info at all

@RepositoryRestResource
interface ModuleRepository extends SolrCrudRepository<Module, String>{


    @Highlight(prefix = "<b>", postfix = "</b>")
    HighlightPage<Module> findByDescriptionContaining(@Param(value = "description") String description, Pageable pageable)


 }

so to recap, calling the auto exposed method will return this:

{
  "_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
  }
}

how can I get the highlighting info using the method above ?

1977
  • 2,580
  • 6
  • 26
  • 37

0 Answers0