0

I was wondering if the index selection logic does prefer local over global index definitions for the same repository paths. Unfortunately I coudn't find any docs on how exactly the index selection algorithm works. To make the things clearer, consider the following examples:

Global definition of "myIndex"

/oak:index/myIndex
  - jcr:primaryType = "oak:QueryIndexDefinition"
  - compatVersion = 2
  - type = "lucene"
  - async = "async"
  - evaluatePathRestrictions = true
  - queryPaths="[/content]"
  - includePaths="[/content]"
  + indexRules
    - jcr:primaryType = "nt:unstructured"
    + nt:unstructured
      + properties
        - jcr:primaryType = "nt:unstructured"
        + code
          - jcr:primaryType = "nt:unstructured"
          - propertyIndex = true
          - name = "myprop"

Local definition of "myIndex"

/content/oak:index/myIndex
  - jcr:primaryType = "oak:QueryIndexDefinition"
  - compatVersion = 2
  - type = "lucene"
  - async = "async"
  - evaluatePathRestrictions = true
  + indexRules
    - jcr:primaryType = "nt:unstructured"
    + nt:unstructured
      + properties
        - jcr:primaryType = "nt:unstructured"
        + code
          - jcr:primaryType = "nt:unstructured"
          - propertyIndex = true
          - name = "myprop"
d33t
  • 1,143
  • 6
  • 15

1 Answers1

2

Index selection logic computes the cost of query against all indexes (local and global). The first cheapest index in evaluation order index is used for the query. You can see this via index debugging tools in AEM.

Imran Saeed
  • 3,414
  • 1
  • 16
  • 27