Hi All,
I am implementing a full text search using the following code
String searchTitle = ""; String searchTerm =request.getParameter("q"); String pageTitle, pagePath; Map<String, String> params = new HashMap<String, String>(); params.put("path", "/content/mysite"); params.put("type","cq:Page"); params.put("fulltext",searchTerm); params.put("orderby", "@jcr:score"); QueryBuilder builder=sling.getService(QueryBuilder.class); Session session = slingRequest.getResourceResolver().adaptTo(Session.class); Query query = builder.createQuery(PredicateGroup.create(params), session); SearchResult searchResult = query.getResult(); for (Hit hit : searchResult.getHits()) { String excerpt=hit.getExcerpt(); }
When i access the matched content from the hit using
hit.getExcerpt();
i am getting the first match (with145 character ).
Is there an way to get all the matched phrases from the content?
Thanks in advance
Views
Replies
Total Likes
getExcerpts() can help you instead of getExcerpt()
https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/day/cq/search/result/Hit.html#
Views
Replies
Total Likes