Hi @Mohanasundaram,
Adding a rule named href won’t help - href isn’t a JCR property on your node; it’s an HTML attribute inside the text string. Oak indexes JCR properties, not HTML attributes. So you must either search/index the text property correctly, or store the URL in its own property and index that.
See below 1 options
1. Keep HTML in text and make full-text work
-
Query with full-text (not equality):
-
In your index:
-
Put the rule under the correct nodeType (usually nt:unstructured for components).
-
Ensure text is analyzed and nodeScopeIndex=true.
-
Avoid HTML stripping if you need attribute values: if your index has an HTMLStripCharFilter, it will drop attributes (and you’ll lose href="/content/national.html").
-
Reindex after changes (reindex=true once).
Minimal example (under /oak:index/yourIndex
indexRules
nt:unstructured
properties
text
analyzed=true
nodeScopeIndex=true
useInExcerpt=true
.
If you must extract href tokens from the HTML string, use a pattern-based token filter (e.g., PatternCaptureGroup) to capture values from href="..."—but this is advanced and depends on what’s allowed in your AEM/Oak version.
OR
2. Best practice: store link separately
Change your component to also write the URL to a dedicated property (e.g., linkURL="/content/national.html"). Then index that real property:
indexRules
nt:unstructured
properties
linkURL
propertyIndex=true
analyzed=true
Now CONTAINS(linkURL, 'national') (or equality on linkURL) will match reliably.
Santosh Sai

