Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Excerpt from QueryBuilder api for Dam:Asset

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

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

Avatar

Level 10

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"

Avatar

Level 2

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

Level 2

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

Level 2

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