cancel
Showing results for 
Search instead for 
Did you mean: 

How to bulid a Lucene query for Tags?

dallinns
Champ on-the-rise
Champ on-the-rise
How do I build a Lucene query to get nodes with specific tags with the cm:taggable aspect?

I've tried:

$query = "TYPE:\"ls:content\" AND @cm\"taggable:\"cat\"";
$returnedFiles = $session->query($spacesStore, $query);
but it doesn't return anything.
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
Suppose you have a tag called "test1". You can find documents tagged with "test1" with the following Lucene query:

PATH:"/cm:categoryRoot/cm:taggable/cm:test1/member"

It is basically the same syntax as it would be for a category. For example, if you wanted to find everything categorized as English, you'd use:

PATH:"/cm:categoryRoot/cm:generalclassifiable/cm:Languages/cm:English/member"

Jeff

dallinns
Champ on-the-rise
Champ on-the-rise
That helped a ton. Thank you.