Issue in multiple word search in AEM when using fulltext property in Lucene search | Community
Skip to main content
Level 2
September 28, 2018
Solved

Issue in multiple word search in AEM when using fulltext property in Lucene search

  • September 28, 2018
  • 3 replies
  • 2864 views

In our application, we have implemented search using "fulltext" property. While this is working fine for single query string, when we enter query string with multiple words (e.g. insurance products xyz), there is an issue. Only when all the multiple words individually have results, we get the results. If even one word among the multiple words does not have results, we get 0 results, which is not ideal behavior. Generally expected behavior is "OR" for all individual words.

For example, consider the below query for fulltext search.

path=/content/product/us

type=cq:Page

fulltext=insurance

Following is the result count for different fulltext values.

fulltext=insurance => 53 results

fulltext=products => 51 results

fulltext=insurance products => 48 results

fulltext=xyz => 0 results

fulltext=insurance products xyz => 0 results

Want to know how the query is processed when we give multiple words in fulltext property, and if there is any configuration to change this default behavior.

Thanks,

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 aneetarora

Hello Vazahat,

The approach suggested by Arun is the path forward.

Just a note about the QueryBuilder functionality that when you search for a string like the following in querybuilder, it will perform a fulltext search for those two words separately in the same property. For example, imagine a property called text with value "Our insurance plans offer the best products in competition", it will be returned for this query. This is the expected behavior as well!

3 replies

arunpatidar
Community Advisor
Community Advisor
September 28, 2018

Hi,

When you use fulltext, it search for node with complete string e.g. 'insurance products xyz'

To achieve search with multiple words you can use group with fulltext

Try below query

path=/content/product/us

type=cq:Page

group.1_fulltext = insurance

group.2_fulltext = products

group.3_fulltext = xyz

group.p.or=true

Arun Patidar
VeenaVikraman
Community Advisor
Community Advisor
September 28, 2018

Yup . I think Arun is right.

aneetaroraAdobe EmployeeAccepted solution
Adobe Employee
September 28, 2018

Hello Vazahat,

The approach suggested by Arun is the path forward.

Just a note about the QueryBuilder functionality that when you search for a string like the following in querybuilder, it will perform a fulltext search for those two words separately in the same property. For example, imagine a property called text with value "Our insurance plans offer the best products in competition", it will be returned for this query. This is the expected behavior as well!