i have a query like this:
SELECT * FROM [cq:Page] WHERE ISDESCENDANTNODE("/content/some/specific/path")
AND LOWER([jcr:content/depth1/depth2/depth3/depth4/prop1]) = "someValue"
AND LOWER([jcr:content/depth1/depth2/depth3/depth4/prop2]) = "someOtherValue"
And i've implemented an oak lucene-property index as follow:
<myIndex
jcr:primaryType="oak:QueryIndexDefinition"
async="async"
compatVersion="{Long}2"
fulltextEnabled="{Boolean}false"
includedPaths="[/content/some/specific/path]"
type="lucene">
<indexRules jcr:primaryType="nt:unstructured">
<cq:Page jcr:primaryType="nt:unstructured">
<properties jcr:primaryType="nt:unstructured">
<prop1
jcr:primaryType="nt:unstructured"
name="jcr:content/depth1/depth2/depth3/depth4/prop1"
propertyIndex="{Boolean}true"/>
<prop2
jcr:primaryType="nt:unstructured"
name="jcr:content/depth1/depth2/depth3/depth4/prop2"
propertyIndex="{Boolean}true"/>
</properties>
</cq:Page>
</indexRules>
</myIndex>
Although "myIndex" is defined correctly it is more expensive (somehow) than the ootb index "ntBaseLucene", i've checked this ootb index and it is bigger in size and does not have this prop1 and prop2 which i am looking for as part of my query.
Here are some description of both as far as i could check:
MyIndex: (not being pick up)
- Small in size
- nodeType specific (cq:Page)
- type Lucene
- Cost is More expensive (while checking with queryDescription tool)
OOTB ntBaseLucene index (being pick up)
- Big in size (at least 4 times bigger than mine)
- No nodeType specific (nt:Base)
- type Lucene
- Cost is cheaper than mine (while checking with queryDescription tool)
Is there any reasonable reason why my index is more expensive than the ootb one? Any input is really appreciated.
Have you tried generating the index via OAK index tool generator? It's free: http://oakutils.appspot.com/generate/index
Generated with the tool, the index looks something like:
Besides the definition above make sure to add
includedPathsbut alsoexcludedPathsto point to at least generic excluded paths that other lucene indexes have: