Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Query Builder example to pass the options in query

Avatar

Level 1

Hello! 

I have used tags as part of my index so that I can query specific to index

jcr:mixinTypes="[rep:AccessControllable]"
    jcr:primaryType="oak:QueryIndexDefinition"
    async="[async,nrt]"
    compatVersion="{Long}2"
    evaluatePathRestrictions="{Boolean}true"
    excludedPaths="[/var,/etc/replication,/etc/workflow/instances,/jcr:system]"
    includedPaths="[/content/data]"
    queryPaths="[/content/data]"
    reindex="{Boolean}false"
    reindexCount="{Long}1"
    seed="{Long}-4788584413483415353"
    type="lucene"
    tags="[customSearch]">
 
Now XPath query is working all good 
/jcr:root/content/data/element(*, cq:Page)[(jcr:contains(., 'venue'))] option (index tag customSearch)
 
How to use the same option using Query Builder ?

fulltext=venue
type=cq:Page
path=/content/data
p.limit=10

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @zankarshah 

You can try using the below in Query builder

 

fulltext=venue
type=cq:Page
path=/content/data
p.limit=10

p.indexTag=customSearch

 

p.indexTag - if set will include an index tag option in the query, It is mentioned in the documentation[0]

 

Thanks,

Sandeep

[0]: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/dev...

View solution in original post

8 Replies

Avatar

Level 6

Hi,

Please elaborate you are query.

You are trying to fing pages with tags or finding pages with full text?

Avatar

Level 1

My main question is how to use the OPTION in Query Builder Debugger tool
In XPATH I can search results with OPTION as follow

/jcr:root/content/data/element(*, cq:Page)[(jcr:contains(., 'venue'))] option (index tag customSearch)

 

What is the equivalent way to do via Query Builder Debugger ?

 

Thanks,

Zankar

Avatar

Community Advisor

Hi @zankarshah 
You can try below from CRX query, I am not sure if it is possible to use OPTION with querybuilder debugger.

Note each index can have multiple tags, and the same tag can be used in multiple indexes. The syntax to limit a query to a certain tag is: <query> option(index tag <tagName>):

XPATH

/jcr:root/content//element(*, nt:file)[jcr:contains(., 'test')] option(index tag x)

 

SQL

select * from [nt:file] where ischildnode('/content') and contains(*, 'test') option(index tag [x])



Arun Patidar

Avatar

Level 3

Hi @zankarshah , I am working on a similar issue, let me know if you found a workaround to fix it

Avatar

Level 1

hi @sateaswa94 

I was not able to use Option in query builder.  Luckily all my nodes were having certain property which I could use easily to identify 

Thanks!

Zankar

Avatar

Correct answer by
Employee

Hi @zankarshah 

You can try using the below in Query builder

 

fulltext=venue
type=cq:Page
path=/content/data
p.limit=10

p.indexTag=customSearch

 

p.indexTag - if set will include an index tag option in the query, It is mentioned in the documentation[0]

 

Thanks,

Sandeep

[0]: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/dev...

Avatar

Level 3

This should be the accepted solution. Thanks sandeep