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 "Amoratinos (via GitHub)" <gi...@apache.org> on 2026/06/25 10:25:23 UTC
[PR] OAK-12269: Allow forcing an index for user/group queries via QueryBuilder index tag [jackrabbit-oak]
Amoratinos opened a new pull request, #2975:
URL: https://github.com/apache/jackrabbit-oak/pull/2975
## OAK-12269
Allow user/group queries to force a specific index by exposing a new `QueryBuilder#setIndexTag(String)` method. When set, the generated XPath statement is augmented with an `option(index tag <tag>)` clause (see the Oak [query option index tag](https://jackrabbit.apache.org/oak/docs/query/query-engine.html#query-option-index-tag)).
### Changes
- **`oak-jackrabbit-api`**: add a `default` no-op `setIndexTag(String)` to the `QueryBuilder` interface, so existing implementations remain source/binary compatible. The exported package version is bumped (minor) accordingly.
- **`oak-core`**: `XPathQueryBuilder` stores the tag; `UserQueryManager#buildXPathStatement` appends the `option(index tag <tag>)` clause and validates the tag against `[a-zA-Z0-9_]+` to prevent query injection.
### Tests
- `XPathQueryBuilderTest`: getter/setter for the index tag.
- `UserQueryManagerTest`: a query with a valid tag executes successfully; an invalid tag is rejected.
- `QueryBuilderTest` (oak-jackrabbit-api): a `QueryBuilder` implementation that does not override `setIndexTag` is never called back into when the default method is invoked, verifying the default is a genuine no-op.
### Compatibility
The new method is a `default` method; consumers and existing providers are unaffected. When a tag is set but no index carries it, the query falls back to normal index selection / traversal.
### Related
- JCR-5248 (consumer side): expose an `indexHint` field in `AuthorizableQueryManager`'s JSON query format. That change depends on this one being released and `oak-jackrabbit-api.version.used` being bumped in Jackrabbit.
๐ค Generated with [Claude Code](https://claude.com/claude-code)
--
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-12269: Allow forcing an index for user/group queries via QueryBuilder index tag [jackrabbit-oak]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #2975:
URL: https://github.com/apache/jackrabbit-oak/pull/2975#issuecomment-4798262713
# Commit-Check โ
```
Commit rejected by Commit-Check.
(c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
/ ._. \ / ._. \ / ._. \ / ._. \ / ._. \
__\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
|| E || || R || || R || || O || || R ||
_.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._
(.-./`-ยด\.-.)(.-./`-ยด\.-.)(.-./`-ยด\.-.)(.-./`-ยด\.-.)(.-./`-ยด\.-.)
`-ยด `-ยด `-ยด `-ยด `-ยด `-ยด `-ยด `-ยด `-ยด `-ยด
Commit rejected.
Type message check failed ==> Add index tag support to user query (QueryBuilder#setIndexTag)
Allow user/group queries to force a specific index by exposing a new
QueryBuilder#setIndexTag(String) method. When set, the generated XPath
statement is augmented with an "option(index tag <tag>)" clause (see the
Oak query-engine index-tag query option).
- oak-jackrabbit-api: add default no-op setIndexTag(String) to the
QueryBuilder interface so existing implementors remain source/binary
compatible; bump the exported package version (minor) accordingly.
- oak-core: XPathQueryBuilder stores the tag; UserQueryManager appends
the option clause to the statement and validates the tag against
[a-zA-Z0-9_]+ to prevent query injection.
- Tests for the new builder accessor and for the generated statement
(valid tag executes, invalid tag is rejected).
Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
The commit message should follow Conventional Commits. See https://www.conventionalcommits.org
Suggest: Use <type>(<scope>): <description>, where <type> is one of: feat, fix, docs, style, refactor, test, chore, perf, build, ci
--- Commit 2/3:
Type message check failed ==> Changed minor version instead of major version
The commit message should follow Conventional Commits. See https://www.conventionalcommits.org
Suggest: Use <type>(<scope>): <description>, where <type> is one of: feat, fix, docs, style, refactor, test, chore, perf, build, ci
--- Commit 3/3:
Type message check failed ==> Add test verifying default setIndexTag is a no-op
Addresses review feedback: verify in the API module that the default
QueryBuilder#setIndexTag(String) implementation does not propagate to any
backing implementation (i.e. does not reach the query manager). Uses a
CALLS_REAL_METHODS mock and verifyNoMoreInteractions to assert the call
has no further effect.
Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
The commit message should follow Conventional Commits. See https://www.conventionalcommits.org
Suggest: Use <type>(<scope>): <description>, where <type> is one of: feat, fix, docs, style, refactor, test, chore, perf, build, ci
```
--
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