如何使用AEM Query Builder在指定路径下仅对已激活页面执行全文检索?
Solution for AEM Query Builder: Full-Text Search on Activated/Published Pages Only
Got it, here's a tailored Query Builder query that meets your requirement—full-text search within a specific path, but only returning pages that are activated/published (ignoring hits from unactivated pages even if their child nodes match the text):
path=/content/skynet type=cq:Page group.p.or=true group.1_fulltext=icon-phone group.1_fulltext.relPath=jcr:content property=cq:lastReplicationAction property.value=Activate p.limit=1 p.offset=0
Let me break down what each part does to make sure it aligns with your needs:
path=/content/skynet: Restricts the search to your target root path, so we don't waste time scanning unrelated content.type=cq:Page: Ensures we only query actual page nodes, not components, assets, or other JCR nodes—this is key because we want to filter based on the page's activation status.group.p.or=true: Sets up a group for full-text conditions (right now there's one, but this lets you add more later with an OR relationship if needed).group.1_fulltext=icon-phone: Defines the keyword you're searching for in the full-text index.group.1_fulltext.relPath=jcr:content: Limits the full-text search to the page's content node (jcr:content)—this is where your page's actual content lives, so we don't search the page node's metadata.property=cq:lastReplicationAction+property.value=Activate: This is the critical filter. It only includes pages where the last replication action was an activation (publish). This ensures that even if a child component under an unactivated page has the text, that page won't show up in results.
Bonus: Include Both Activated and Published Statuses
If your AEM environment uses both Activate and Published values for published pages, you can adjust the property filter to match either:
property=cq:lastReplicationAction property.value=Activate property.value=Published property.operation=OR
This way, pages marked with either status will be included in the search results.
内容的提问来源于stack exchange,提问作者Oliver
相关产品推荐
相关产品推荐

