Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

fulltext in query doesn't work for partial search term

salamswapnil
Level 2
Level 2

Hello 

We are not getting results for partial keywords search by query.

e.g.

It doesn't return results for below query

type=cq:Page
path=/content/mysite/us/en/resources
fulltext=Ind
 
But it gives results for below one.
type=cq:Page
path=/content/mysite/us/en/resources
fulltext=India
 
Is this an expected behavior or am I missing anything here?
 
Thanks
Swapnil
1 Accepted Solution
salamswapnil
Correct answer by
Level 2
Level 2

Thank you everyone for your responses. We are able to achieve expected behavior (partial keyword search) by appending '*' in the fulltext term.

e.g. Below query gives all the results having text "Ind[xxxxx]". This is similar to wildcard character search in lucene.

type=cq:Page
path=/content/mysite/us/en/resources
fulltext=Ind*
 
PS : It comes with slight performance overhead. 

View solution in original post

6 Replies
Rajalakshmi
Level 2
Level 2

Hi @salamswapnil, full-text field searches for the whole word that matches the search key anywhere in webpages.

If your search key is "Ind" then it searches for Ind everywhere on pages

FYR => tothenew.com/blog/full-text-search-in-aem-using-query-builder/

 

 

 

kautuk_sahni
Community Manager
Community Manager
@Rajalakshmi, Thank you for participating in the AEM community. Good to have AEM SME's like you. Looking forward to see you more into the community. Keep it up.
Rajalakshmi
Level 2
Level 2
@kautuk_sahni, Thanks for your inspiring insights, this would keep me more evolve, engaged and contribute a lot more to the community.
asutosh_jena
Community Advisor
Community Advisor

Hi @salamswapnil 

The term "full-text" itself contains the answer. Whenever we use a full-text search as the predicate, AEM will internally try to look for any occurances where it can find the exact search text as a whole word.


It's exactly works in the same way as SQL2 below:
SELECT * FROM [nt:unstructured] WHERE ISDESCENDANTNODE('/jcr:root/content/mysite/us/en/resources') AND LOWER([prop]) LIKE "%Ind%" ORDER BY [cq:lastModified] desc


As you mentioned you are correct and it will always return the full text result if found any.

Hope this helps!
Thanks!

bilal_ahmad
Level 5
Level 5

Hey @salamswapnil

 

The results you are getting are just right, as you're making use of fulltext search. You can create synonyms(a text file) and then based on your search text(like Ind = you'd expect to fetch it the result for India). Nicely explained by @Albin_Issac on his blog: https://medium.com/tech-learnings/how-to-enable-search-synonyms-in-aem-with-lucene-ccb780375eb4 

 

Hope this would help!

 

Thanks,

Bilal.

salamswapnil
Correct answer by
Level 2
Level 2

Thank you everyone for your responses. We are able to achieve expected behavior (partial keyword search) by appending '*' in the fulltext term.

e.g. Below query gives all the results having text "Ind[xxxxx]". This is similar to wildcard character search in lucene.

type=cq:Page
path=/content/mysite/us/en/resources
fulltext=Ind*
 
PS : It comes with slight performance overhead. 

View solution in original post