Thomas Mueller created OAK-12171:
------------------------------------

             Summary: Cost estimation for "is null" checks is wrong
                 Key: OAK-12171
                 URL: https://issues.apache.org/jira/browse/OAK-12171
             Project: Jackrabbit Oak
          Issue Type: Improvement
          Components: indexing
            Reporter: Thomas Mueller


For this index and queries, the cost estimation of Lucene indexes is almost the 
same no matter if the null check is used or not. The cost estimation also 
ignores the weight. This should not be the case.
{noformat}
{
    "custom.test": {
        "async": [ "async", "nrt" ],
        "compatVersion": 2,
        "evaluatePathRestrictions": true,
        "includedPaths": [ "/content" ],
        "jcr:primaryType": "oak:QueryIndexDefinition",
        "queryPaths": [ "/content" ],
        "selectionPolicy": "tag",
        "tags": [ "abc" ],
        "type": "lucene",
        "indexRules": {
            "nt:unstructured": {
                "properties": {
                    "test": {
                        "nullCheckEnabled": true,
                        "name": "updated",
                        "weight": 10000,
                        "propertyIndex": true
                    }
                }
            }
        }
    }
}

/jcr:root/content//element(*, nt:unstructured)[fn:name() = 'test' and 
not(@updated)] option (index tag abc)
cost for [/oak:index/custom.test-1-custom-8] of type (lucene-property) with 
plan [lucene:custom.test-1-custom-8
    indexDefinition: /oak:index/custom.test-1-custom-8
    estimatedEntries: 102
    luceneQuery: +:ancestors:/content +:nullProps:updated
] is 103.00

/jcr:root/content//element(*, nt:unstructured)[fn:name() = 'test'] option 
(index tag abc)
cost for [/oak:index/custom.test-1-custom-8] of type (lucene-property) with 
plan [lucene:custom.test-1-custom-8
    indexDefinition: /oak:index/custom.test-1-custom-8
    estimatedEntries: 103
    luceneQuery: :ancestors:/content
] is 104.00
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to