Expand my Community achievements bar.

How to exclude certain properties from fulltext search

Avatar

Level 4

I am using following query for fulltext search

 

type=cq:Page

path=/content/we-retail/en

fulltext=cricket

 

It is getting certain results which are not needed in the results. Is there a way to restrict the results.

 

thanks in advance

6 Replies

Avatar

Community Advisor

Hey @vasimakram 

 

You can use : 

 

  • property.operation - The operation you want to perform for the test. The available operations are equals, unequals, like, not, exists.

For example :

 

type=cq:Page

path=/content/we-retail/en

fulltext=cricket

property=formatODI

property.operation=not

 

Please let me know in case of any further assistance.

 

Thanks

 

 

Avatar

Level 4

property.operation = not will be used to check if property value is not equal to some value. It will not work for fulltext

Avatar

Community Advisor

Hey @vasimakram 

 

I tried with exists and not and it worked perfectly fine. 

 

Query 1 : 

Shows all pages having keyword- 'car' and where editOption property exists

ksh_ingole7_0-1662645902047.png

 

Query 2 :

 

Shows all pages having keyword- 'car' and where editOption property does not exist

ksh_ingole7_1-1662646010380.png

 

Please let me know in case of further queries

 

 

Avatar

Level 4

This will work for property search. Not for full text search.

When I do fulltext search I am getting pages where this text is available. In one of the page I have used banner component. This component have one background image.

like

HTML:
<img src="/content/dam/wknd/cricket-stadium.jpg">
<div>..........</div>
</img>
HTL:
<img src="${properties.bgImg}">
<div></div>
</img>


In this case the image path has my fulltext keyword. I wan't to ignore bgImg property from the results 

Avatar

Community Advisor

Can you briefly explain your use case/requirement @vasimakram ? It'll make it easier to get to a solution.

Avatar

Level 4

Hi @vasimakram ,

 

You can also add a page property like a check box to hide in search. If that checkbox is enabled on the page then it will not show up in search results.

Modify the query to check for the property

 

type=cq:Page

path=/content/we-retail/en

fulltext=cricket

boolproperty=@jcr:content/hideInSearch

boolproperty.value=false

 

Hope this helps.