You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "thomasmueller (via GitHub)" <gi...@apache.org> on 2026/09/16 14:23:35 UTC
[PR] OAK-12100: account for nodeName condition in Lucene/Elastic index cost estimation- #3128 [jackrabbit-oak]
thomasmueller opened a new pull request, #3130:
URL: https://github.com/apache/jackrabbit-oak/pull/3130
## Problem
Queries that combine a nodeName condition (SQL2 `NAME(node) = 'x'` / xpath `fn:name()`,
which the query engine turns into the `:localname` filter restriction, matched against the
index's `:nodeName` field) OR'd with property restrictions run inefficiently.
The shared `FulltextIndexPlanner` did not take the nodeName condition into account when
estimating index cost. As a result the reported cost was unrealistically high, so the
property/nodeName filters were not pushed down to the index — only the ancestor/path filter
was applied and the rest of the condition was evaluated by traversal. Because the cost
estimation lives in the shared `oak-search` planner, both Lucene and Elastic are affected.
## Fix
When the filter has a nodeName (`:localname`) restriction that the index can evaluate
(`canEvalNodeNameRestriction`), its selectivity is now accounted for in cost estimation,
treating it like a default-weight indexed property.
The `:nodeName` field is not a regular property field (it starts with `:`), so it has no
per-field statistics and is never part of `propDefns`. The estimate therefore uses `numDocs`
scaled by `DEFAULT_PROPERTY_WEIGHT`, with the weight capped at 3 for a non-equality (LIKE)
restriction — mirroring how regular properties are handled. The change is applied to both
cost paths: the default `getMaxPossibleNumDocs` and the feature-flagged selectivity model.
## Tests
Added `IndexPlannerTest` cases covering nodeName cost estimation across:
- both cost paths (default and selectivity model),
- EQUAL and LIKE operators, and
- nodeName alone vs combined with a property restriction.
Each new test was confirmed to fail without the production change. The full `IndexPlannerTest`
(87) and `oak-search` (164) suites pass, and `LucenePropertyIndexTest` shows no regressions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12100: account for nodeName condition in Lucene/Elastic index cost estimation- #3128 [jackrabbit-oak]
Posted by "thomasmueller (via GitHub)" <gi...@apache.org>.
thomasmueller merged PR #3130:
URL: https://github.com/apache/jackrabbit-oak/pull/3130
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12100: account for nodeName condition in Lucene/Elastic index cost estimation- #3128 [jackrabbit-oak]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3130:
URL: https://github.com/apache/jackrabbit-oak/pull/3130#issuecomment-5701546839
## [](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=3130) **Quality Gate failed**
Failed conditions
 [B Maintainability Rating on New Code](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=3130&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true) (required ≥ A)
<!-- sqra:qg_revision=31a52c6ed834b78337e8fb6ec662e74ebd706993c63ac86d2d250d92b7036681 -->
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=3130)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org