Excerpt property in AEM Lucene Search | Community
Skip to main content
Level 2
December 13, 2018
Solved

Excerpt property in AEM Lucene Search

  • December 13, 2018
  • 6 replies
  • 5489 views

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

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 edubey

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

6 replies

edubey
edubeyAccepted solution
Level 10
December 14, 2018

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

cquser1
Level 7
January 9, 2019

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.

Gaurav-Behl
Level 10
January 9, 2019

please share more details about the issue

sathishreddy
Level 2
December 2, 2019

Hi Vazahat,

Did you get any resolution for this?

Thanks,

Satish

Shashi_Mulugu
Community Advisor
Community Advisor
December 2, 2019

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();

sathishreddy
Level 2
December 3, 2019

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