Expand my Community achievements bar.

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
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

View solution in original post

3 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

Correct answer by
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