List of usage examples for org.springframework.data.solr.core.query.result HighlightPage getHighlighted
List<HighlightEntry<T>> getHighlighted();
From source file:example.springdata.solr.AdvancedSolrRepositoryTests.java
/** * {@link HighlightPage} holds next to the entities found also information about where a match was found within the * document. This allows to fine grained display snipplets of data containing the matching term in context. *///from w w w .jav a2 s .c o m @Test public void annotationBasedHighlighting() { HighlightPage<Product> products = repository.findByDescriptionStartingWith("play", new PageRequest(0, 10)); products.getHighlighted().forEach(entry -> entry.getHighlights().forEach(highligh -> System.out.println( entry.getEntity().getId() + " | " + highligh.getField() + ":\t" + highligh.getSnipplets()))); }