Question about excerpt from com.day.cq.wcm.foundation.Search | Community
Skip to main content
New Participant
October 16, 2015
Solved

Question about excerpt from com.day.cq.wcm.foundation.Search

  • October 16, 2015
  • 2 replies
  • 853 views

    We are using the com.day.cq.wcm.foundation.Search object to do basic full text searches in our site and I've got a question about how it determines what value to assign to Search.Hit.excerpt. We've got the following properties defined for excerpt properties: text, jcr:description, history:caption, and history:description. If the search terms are found in any of those properties the excerpt is returned correctly, but if they're not found in those properties the excerpt returned is the last 60 characters from the history:description field. Is this expected behavior for the search?  

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 smacdonald2008

If there are no matching properties - the result set should be empty, not return last 60 chars. See the Javadoc for more information:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/foundation/Search.html

For those reading this thread and wanting to know how to build an AEM component that uses this API -- see this article:

http://docs.adobe.com/docs/en/aem/6-0/develop/the-basics/website.html

There is a sub section titled: CREATING THE SEARCH COMPONENT.

2 replies

smacdonald2008
smacdonald2008Accepted solution
New Participant
October 16, 2015

If there are no matching properties - the result set should be empty, not return last 60 chars. See the Javadoc for more information:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/foundation/Search.html

For those reading this thread and wanting to know how to build an AEM component that uses this API -- see this article:

http://docs.adobe.com/docs/en/aem/6-0/develop/the-basics/website.html

There is a sub section titled: CREATING THE SEARCH COMPONENT.

New Participant
October 16, 2015

Sorry - I should have been more clear. There were results found but the search text was found in the node name and that was not listed in the fields defined for excerpts.