Excerpt from QueryBuilder api for Dam:Asset | Community
Skip to main content
Level 2
October 16, 2015
Solved

Excerpt from QueryBuilder api for Dam:Asset

  • October 16, 2015
  • 5 replies
  • 3013 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

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

5 replies

Level 2
October 16, 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

Level 2
October 16, 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");

Level 2
October 16, 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

smacdonald2008
Level 10
October 16, 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"

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
October 16, 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