Expand my Community achievements bar.

SOLVED

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

Avatar

Level 3

    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?  

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

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.

Avatar

Level 3

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.