Customizing the order of search results

By TA Digital Marketing Team 1 min read

Suppose you have a group of nodes/pages on your site for e.g. FAQs, Case Studies and you want to provide a feature so that visitors can search for that content.  You also want to give higher weightage to some properties/field values of the node/page.  For e.g. if the search term occurs in the title then show that result first.

The following are the configuration steps to achieve this.

1. Update \crx-quickstart\repository\workspaces\crx.default\workspace.xml and add the line below (bolded)

Code:

<SearchIndex class="com.day.crx.query.lucene.LuceneHandler"> <param name="path" value="${wsp.home}/index"/> <param name="resultFetchSize" value="50"/> <param name="indexingConfiguration" value="${wsp.home}/indexing_config.xml"/> </SearchIndex>

2. Create the file /crx-quickstart/repository/workspaces/crx.default/indexing_config.xml and copy the content from this link.

http://helpx.adobe.com/experience-manager/kb/SearchIndexingConfig.html

3. Include the following lines in the above the file. Change the condition and properties as per your need.

<index-rule nodeType="nt:unstructured" condition="@sling:resourceType = 'app1/components/faq'"> <property boost="3.0">question</property> <property >answer</property> <property >sling:resourceType</property> </index-rule>

4. Re-index the repository.

Delete the following in the directory /crx-quickstart/repository/workspaces/crx.default/

/index/

/index_xxx.tar

5. Now write your query and use fulltext search on the relevant properties that you are searching.

Sample Query:

path=/content/xxx/FAQs/jcr:content/ type=nt:unstructured 1_property=sling:resourceType 1_property.value=app1/components/faq group.p.or=true group.1_fulltext=My_Search_String [email protected] group.2_fulltext= My_Search_String [email protected]

References:

How to use ‘Boosts’ at Indexing Time and at Query Runtime

Indexing Configuration

If you would like more help optimizing or managing your AEM Contact Us Today.

Explore Additional Resources

Learn more on how to select the right CMS for your business and improve your customer’s Digital Experience.

Our Adobe Experience Cloud Consulting team specializes in helping you deliver a seamless, intelligent, and personalized customer experience.

Our Certified Sitecore Experience Platform and Sitecore MVP’s specialize in helping you deliver seamless contextually personalized customer experiences.

About TA Digital

TA Digital is the only global boutique agency that delivers the “best of both worlds” to clients seeking to achieve organizational success through digital transformation. Unlike smaller, regional agencies that lack the ability to scale or large organizations that succumb to a quantity-over-quality approach, we offer resource diversity while also providing meticulous attention to the details that enable strategic success.

Over the past 20 years, TA Digital has positioned clients to achieve digital maturity by focusing on data, customer-centricity and exponential return on investment; by melding exceptional user experience and data-driven methodologies with artificial intelligence and machine learning, we enable digital transformations that intelligently build upon the strategies we set into motion. We are known as a global leader that assists marketing and technology executives in understanding the digital ecosystem while identifying cultural and operational gaps within their business – ultimately ushering organizations toward a more mature model and profitable digital landscape.

Recognized in 2013, 2014, 2015, and 2019 Inc. 5000 list as one of the most successful technology companies in the United States, TA Digital is pleased also to share high-level strategic partnerships with world class digital experience platform companies like Adobe, SAP and Salesforce and possess global partnerships with industry leaders such as Sitecore, Episerver, Elastic Path, BigCommerce, AWS, Azure and Coveo.

TA Digital Marketing Team

Written By

TA Digital Marketing Team

More Blogs by the author

12 ways AI is transforming DevOps
12 Ways AI is Transforming DevOps TA Digital Marketing Team 5 min read