java - Is there any other alternative to template specific exclusion of pages from search -


i have restricted pages admin pages not getting visible in search results.using below code

map.put("group.1_group.1_property","**jcr:content/cq:template**"); map.put("group.1_group.1_property.1_value","**/apps/myapp/templates/sampletemplate**");   map.put("group.1_group.1_property.and","true"); map.put("group.1_group.1_property.operation","unequals");   final  query finalquery = builder.createquery(predicategroup.create(map),                     session); 

which means template specific search filtration,means im telling query builder not display pages having above specified template .however drawback that, in future if want restrict more pages, pages must mapped above template. instead of specifying template in map, can put other property in map, search restriction not template specific. thanks, balaji

what other properties pages have available (specifically, admin pages)? example, if have specific property add admin pages, or other pages sort on, work. on 1 site worked on, had property put content items called hideinnav. along lines, how it:

map.put("group.1_group.1_property","jcr:content/hideinnav"); map.put("group.1_group.1_property.1_value","/content/somepath/you/want");  map.put("group.1_group.1_property.and","true"); map.put("group.1_group.1_property.operation","unequals"); 

i hope helps make sense of it. understanding correctly? if not, please clarify , i'll try more.

---------------edit-----------------------

if don't have custom property, know path these pages located, , maybe default property have in common (like jcr:title), try doing instead. this:

map.put(1_group.0_path","/content/yoursite"); map.put(2_group.0_type","cq:page"); map.put(3_group.fulltext","test text"); map.put(3_group.fulltext.relpath","jcr:content/@jcr:title"); 

you can see how run on local query debugger when have cq running:

http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=utf-8&query=http%3a%2f%2flocalhost%3a4502%2fcontent%2fsalesportal%2fen%2fmobile%2fresources.assets.get.json%3fp.limit%3d7%0d%0a1_group.0_path%3d%2fcontent%2fyoursite%0d%0a2_group.0_type%3dcq%3apage%0d%0a3_group.fulltext%3dtest+text%0d%0a3_group.fulltext.relpath%3djcr%3acontent%2f%40jcr%3atitle 

hopefully that's more helpful.

edit #2

this summary of both answers, , answer last comment well.

in order more answer question (since you're still not quite getting want), dug little deeper find information need. reference, time you're doing xpath querying, great tool at: jcr query usecases - jboss

anyway, said getting results didn't include items missing 'hideinnav' property. here how can results, specifically:

map.put("1_group.0_path","/content/yoursite"); map.put("2_group.0_type","cq:page"); map.put("3_group.1_property","jcr:content/hideinnav"); map.put("3_group.1_property.1_value","not"); map.put("3_group.1_property.operation","not"); 

this way, you're searching in path want, getting type of result want (cq:page, if you're looking for), , you're getting results not have property 'hideinnav'.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -