Lucene Indexing for content fragment "unique" text field option | Community
Skip to main content
Level 2
October 9, 2025
Solved

Lucene Indexing for content fragment "unique" text field option

  • October 9, 2025
  • 1 reply
  • 312 views

I have a content fragment with a text box that has the “unique” option enabled. When the fragment loads, it triggers the unique field validation call (/mnt/overlay/dam/cfm/admin/components/authoring/validations/uniquefield.json), but it doesn’t return any response.

In the Query Performance tool, I can see the following error:

“The query read or traversed more than 100000 nodes. To avoid affecting other tasks, processing was stopped.”

To fix this issue, I configured Lucene indexing for this query:

/jcr:root/content/dam//element(*, dam:cfVariationNode)[(@location = 'market')] option (index tag fragments)

I used the Oak Index Generator (https://thomasmueller.github.io/oakTools/indexDefGenerator.html to create the index definition. However, it didn’t work. After adding the configuration, the Content Fragment didn’t use the index. I tried restarting and reindexing, but there was no luck.\

What could be the issue?

 

{ "/oak:index/damcfVariationNodeLucene-12-custom-1": { "async": [ "async", "nrt" ], "compatVersion": 2, "evaluatePathRestrictions": true, "includedPaths": [ "/content/dam" ], "jcr:primaryType": "oak:QueryIndexDefinition", "queryPaths": [ "/content/dam" ], "selectionPolicy": "tag", "tags": [ "fragments" ], "type": "lucene", "indexRules": { "jcr:primaryType": "nt:unstructured", "dam:cfVariationNode": { "jcr:primaryType": "nt:unstructured", "properties": { "jcr:primaryType": "nt:unstructured", "location": { "jcr:primaryType": "nt:unstructured", "name": "str:location", "propertyIndex": true } } } } } }

 

 

 

 

 

Best answer by SantoshSai

Hi @vijayselvas1,

In your JSON you have:

"location": {
  "jcr:primaryType": "nt:unstructured",
  "name": "str:location",
  "propertyIndex": true
}

But the query you shared is:

/jcr:root/content/dam//element(*, dam:cfVariationNode)[(@location = 'market')]

The problem is that you’re using "name": "str:location". Oak interprets that literally as a string-typed property called str:location, not just location.

Instead, you should define it like this:

"location": {
  "propertyIndex": true,
  "name": "location",
  "type": "String"
}

 

1 reply

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
October 9, 2025

Hi @vijayselvas1,

In your JSON you have:

"location": {
  "jcr:primaryType": "nt:unstructured",
  "name": "str:location",
  "propertyIndex": true
}

But the query you shared is:

/jcr:root/content/dam//element(*, dam:cfVariationNode)[(@location = 'market')]

The problem is that you’re using "name": "str:location". Oak interprets that literally as a string-typed property called str:location, not just location.

Instead, you should define it like this:

"location": {
  "propertyIndex": true,
  "name": "location",
  "type": "String"
}

 

Santosh Sai
Level 2
October 9, 2025

Thanks @santoshsai . It's working now.