Implementing full text search

Avatar

Avatar
Validate 1
Level 1
neethak90936115
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
neethak90936115
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
neethak90936115
Level 1

10-11-2016

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

View Entire Topic

Avatar

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

161 likes

Total Posts

2,114 posts

Correct reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile

Avatar
Boost 50
Level 10
Sham_HC
Level 10

Likes

161 likes

Total Posts

2,114 posts

Correct reply

1,204 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile
Sham_HC
Level 10

22-11-2016