Advanced Search
Using the Advanced Search
When using a list, select from the 'Build list using' options 'Advanced Search.' This will open a new tab in the list window with one text box labeled: 'Querybuilder Predicate Notation.' This is asking for a few lines of code to define search parameters.
Example Code - With Explanations of Results
Searching for Pages
type=cq:Page
property=jcr:content/jcr:title
property.value=Places
- 'type' defines what sort of object you'll be searching for (it's usually a page).
- 'property' defines what property of the object you'll be filtering by; in this case, its by the title.
- 'property.value' defines your search term.
So this search would be searching all PAGES with the TITLE of PLACES.
So it would find every page titled Places.
*IMPORTANT* Searches by title ARE case-sensitive, so 'Places' is not the same as 'places'.
type=cq:Page
path=/cq/sandbox
property=jcr:content/jcr:title
property.operation=like
property.value=Sub%
By including 'property.operation=like' and using the '%' wildcard, multiple pages with similar titles can be pulled by the same search.
A wildcard is a character that the program reads as able to stand in for any character in any number (e.g. 'stair%' would get pages named 'stair', 'stairs', and even 'stair case'; and '%stair%' could get a page like 'upstairs', or 'get upstairs').
*REMEMBER* Titles are case-sensitive, but wildcards will search for both cases.
type=cq:Page
property=jcr:content/cq:template
property.value=/apps/odu/templates/places
Similarly, this search would be searching all PAGES with the TEMPLATE located at /APPS/ODU/TEMPLATES/PLACES.
So it would find every page made with the Places template.
type=cq:Page
property=jcr:content/par/section/listpages/listFrom
property.value=querybuilder
By viewing the .5.json information of a page, you can narrow down to almost any page property you want to search by. For example, this search would find every Page that has an advanced search component that is contained in a 'section' component.
In the /adv-search.5.json page, you can see the path to each component, reading like an outline.
If it appears as a continuous line of text, download a json viewer. A good choice for firefox users is: http://jsonview.com/
type=cq:Page
tagid=org:acadaffairs/acadenhancement
tagid.property=jcr:content/cq:tags
path=
path.exact=true
By using 'tagid', you can search by tags (just make sure you're using the full tag), just set the 'tagid' to your desired tag, and set 'tagid.property' to 'jcr:content/cq:tags', which is where the search program will find the tags.
More on the 'path' feature, by including 'path.exact=true' it limits the scope of the search to only that level, not the child directories, meaning it will only search the pages under '' and not, for example, pages under '/elt'. In this case, it lets you find all pages tagged with 'org:acadaffairs/acadenhancement' under '' and didn't pull any of the child pages of the pages it found.
type=cq:Page
fulltext=monarch
path=/cq/sandbox
You can even search for pages that have certain text on them by using 'fulltext' to define your search. 'Fulltext' searches not just the words on the page, but also for object titles (like images).
In cases like this, and others, it would be good to limit the scope of your search so it won't try searching every page on the site for a string of words. do this by using 'path' to define your search area.
This essentially is checking if a page has the text you're looking for AND is under the defined path.
type=cq:Page
fulltext=monarch
group.p.or=true
group.1_path=/cq/sandbox
group.2_path=/about
If you want to search under multiple paths, include the line 'group.p.or=true'; it tells the search that the search parameters under 'group' are OR statements. In that, it will be checking if a page has the text you're looking for AND is under path 1 OR 2.
For those who like boolean statements, it's easy to consider it like this:
(fulltext=monarch) AND (path=1_path OR path=2_path)
type=cq:Page
path=/cq/sandbox
group.p.or=false
group.1_fulltext=monarch
group.2_fulltext=college
If you want to narrow your search by using two text searches, include the line 'group.p.or=false'; it tells the search that the search parameters under 'group' are AND statements. In that, it will be checking if a page under the given path AND contains text1 AND text2.
For those who like boolean statements, it's easy to consider it like this:
(path=path) AND (fulltext=text1 AND fulltext=text2)
Searching for Assets
type=cq:Page
tagid=org:acadaffairs/acadenhancement
tagid.property=jcr:content/cq:tags
path=
path.exact=true
group.p.not=true
group.path=/academicenhancement
group.path.self=true
If you want to narrow your search by excluding a certain path or other search parameter, make a group and use the line 'group.p.not=true', it tells the search that the group will be treated as a 'not' statement. Be sure to include 'group.path.self=true', it tells the search to look in the base node.
type=dam:Asset
path=/content/dam/odu/col-dept/teacher-education-services/docs
nodename=*.doc
When searching for assets, use 'type=dam:Asset' and make sure that the path (if used) is pointing to somewhere in the dam.
Defining 'nodename' limits the search to files with the given file extension (eg .pdf .jpg .jpeg .docx .ppt).
type=dam:Asset
path=/content/dam/odu/col-dept/teacher-education-services/docs
property=jcr:content/metadata/dc:title
property.1_value=Entry Assessment into Virginia Approved Programs - Revised April 2010
property.2_value=Statement of Acknowledgement
By including 'property=jcr:content/metadata/dc:title' you can search by title. To search for more than one title use 'property.1_value=title1' and so on for as many titles as needed, otherwise, you can just use 'property.value=title'.
type=dam:Asset
path=/content/dam/odu/col-dept/teacher-education-services/docs
property=jcr:content/metadata/dc:title
property.operation=like
property.value=%2011%
By including 'property.operation=like' and using the '%' wildcard, multiple assets with similar titles can be pulled by the same search.
A wildcard is a character that the program reads as able to stand in for any character in any number (e.g. 'stair%' would get assets named 'stair', 'stairs', and even 'stair case'; and '%stair%' could get an asset like 'upstairs', or 'get upstairs').
*REMEMBER* Titles are case-sensitive, but wildcards will search for both cases.
type=dam:Asset
path=/content/dam/odu/col-dept/teacher-education-services/docs
group.p.and=true
group.1_property=jcr:content/metadata/dc:title
group.1_property.value=%Post%
group.1_property.operation=like
group.2_property=jcr:content/metadata/dc:title
group.2_property.value=%2011%
group.2_property.operation=like
By making use of groups, you can search for titles that fulfil multiple requirements. The search on the right will find all documents under the given path that include 'Post" AND '2011' somewhere in the title.
type=dam:Asset
path= /content/dam/odu/news/insideodu/2014/02/27
nodename= feature2-lg*.jpg
Returns all files that begin with 'feature2-lg' and end with '.jpg' in the /content/dam/odu/news/inside/odu/2014/02/27 folder.
This would be useful in creating rules for galleries that would be calling on similarly named images.
'nodename' seems to refer to the actual filename, as opposed to the asset title.