Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 5

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!

View solution in original post

3 Replies

Avatar

Community Advisor

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

Avatar

Community Advisor

Yup . I think Arun is right.

Avatar

Correct answer by
Level 5

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!