We are using "excerpt" property in our query to show the description in search results. We have configured two fields "jcr:description" and "subtitle" as excerpt properties in QueryBuilderImpl configuration. It is working fine, until the description has less than 150 characters. If it is more than 150 characters, then the excerpt property returns only part of the description, but the issue is it breaks and returns the ending part of the description, not the staring part.
For example, if my jcr:description is as below
This is a sample text to show how the excerpt property behaves when the description has more than 150 characters, so i have added 158 characters in this text.
The excerpt property returns,
characters, so i have added 158 characters in this text.
Is there any configuration, where we can change the character length for the excerpt property? Can we make any change to at least show the starting part of the description rather than the ending part?
Thanks & Regards,
P. Vazahat Fatima
Solved! Go to Solution.
Not sure if that's the design behavior for text greater than length, would request you to reach out to daycare
Here is the URL https://daycare.day.com/home.html
Views
Replies
Total Likes
Not sure if that's the design behavior for text greater than length, would request you to reach out to daycare
Here is the URL https://daycare.day.com/home.html
Views
Replies
Total Likes
Hi Vazahat,
Did you get a resolution to this issue.
Any thoughts/pointers you got w.r.t this? In case you have some details, please post it here. Would be really helpful.
please share more details about the issue
Views
Replies
Total Likes
Hi Vazahat,
Did you get any resolution for this?
Thanks,
Satish
Views
Replies
Total Likes
Can you try creating your own excerpt with HIT object. Try below where "this" is "Hit" object.
Excerpt.create(this, this.query.getExcerptPropertyNames(), 150).getText();
Views
Replies
Total Likes
Hi Shashi,
Thank you for your reply.
Actually my requirement is read all text content from pages and convert it as string then I have to send to search team they will crawl the content.
I am reading the content which created by using title and text components. But I am also facing issue like Vazahat. Below is my code
session = resourceResolver.adaptTo(Session.class);
Map<String, String> map = new HashMap<String, String>();
map.put("path", "/content/mysite/en/pageUrl");
map.put("group.p.or", "true");
map.put("group.1_property", "sling:resourceType");
map.put("group.1_property.value", "components/content/text");
map.put("group.2_property", "sling:resourceType");
map.put("group.2_property.value", "components/content/title");
builder= resourceResolver.adaptTo(QueryBuilder.class);
Query query = builder.createQuery(PredicateGroup.create(map), session);
SearchResult sr= query.getResult();
for (Hit hit : sr.getHits()) {
LOGGER.info("excerpt: " + hit.getExcerpt()) ;
}
But here I am not able to find Excerpt class and I am using AEM 6.4. And please correct me if the way I am doing.
Thanks,
Satish
Views
Replies
Total Likes