Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Excerpt from QueryBuilder api for Dam:Asset

Avatar

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile
vishalv75424481
Level 1

15-10-2015

I want to get the excerpt(5 words before and after the search term) for the given fulltext search. I am trying hit.getExceprt() and it returns null. I know that I can set the excerpt properties in web console, but we can only set the jcr:properties there and I am not sure how to specify the content to include in the excerpt. 

I also read that you can write a query in the indexer to index the summary. I am not sure how this is done and if it is the best approach.

Please help.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
MVP
bsloki
MVP

Likes

182 likes

Total Posts

1,859 posts

Correct Reply

545 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 50
Boost 5
View profile

Avatar
Validate 25
MVP
bsloki
MVP

Likes

182 likes

Total Posts

1,859 posts

Correct Reply

545 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 50
Boost 5
View profile
bsloki
MVP

15-10-2015

Hi Vishal,

I think excerpt is mainly used here to highlight the string you have used in your search and not really to set as a condition in your query. refer [1] to know more about that. 

However can you send us your query snapshot and also AEM version you are using

[1] https://docs.adobe.com/docs/en/cq/5-6-1/core/developing/searching_in_crx.html

Answers (4)

Answers (4)

Avatar

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile
vishalv75424481
Level 1

15-10-2015

Scott - Sorry I addressed you as Sam. 

I tried the fulltext search example on Geometrixx. I dont see the excerpt for pdf files even there.

 

Regards,

Vishal

Avatar

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile
vishalv75424481
Level 1

15-10-2015

Thanks bsloki,

Please find below the search query

map.put("path", properties.get("searchPath", searchPath));
map.put("type","dam:Asset");
map.put("fulltext",searchTerm);
map.put("p.offset", ""+x);
map.put("p.limit", ""+noOfResultsPerPage);

map.put(groupTagId,"tag_id" );

map.put(groupTagIdProperty,"jcr:content/metadata/cq:tags");

Avatar

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile

Avatar
Validate 10
Level 1
vishalv75424481
Level 1

Likes

0 likes

Total Posts

26 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
View profile
vishalv75424481
Level 1

15-10-2015

Thanks Sam. I was expanding on the word excert by saying "5words before and after". What I actually meant was highlight the search term and in the excerpt it usually shows the sentence that the search term is found in.

My search query does not return 0 results. The query is working fine. I get the excerpt if the returned result is a page. But if it is a Pdf(dam:Asset), I do get results but the excerpt is null or empty. 

Regards,

Vishal

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

15-10-2015

There are many different ways to setup QueryBuilder searches. 

See this AEM doc topic - it includes examples of using FullText (its shows using Full text and Geometrixx🙂 

 

https://docs.adobe.com/docs/en/cq/5-6-1/dam/customizing_and_extendingcq5dam/query_builder.html

If you are getting 0 results - it means that you have not setup your Query properly. Can you post your QueryBuilder example so community can see exactly what you are trying to do. 

 I am not clear what you mean by "5 words before and after the search term"