[
https://issues.apache.org/jira/browse/OAK-12509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul Chibulcuteanu updated OAK-12509:
-------------------------------------
Description:
An index can be given tags with the tags property, and a query can then
select it with option(index tag ...) . However, the query parser only accepts
the characters a-z, A-Z, 0-9, _ in the tag value. Any tag with a hyphen ( - )
or a dot ( . ) is rejected as a syntax error, even when it exactly matches a
tag configured on the index.
Index names have no such restriction. option(index name ...) works with names
that contain these characters, for example damAssetLucene-12-custom-1 .
Steps to reproduce:
1. Configure an index with:
{code}
"tags": ["personalization", "pages", "semantic-pages", "semantic.pages"]
{code}
2. Run a query with option(index tag pages) . It works.
3. Run the same query with option(index tag semantic-pages) or option(index
tag semantic.pages) , either bare, quoted or in brackets. It fails with a parse
error: expected: a-z, A-Z, 0-9, _ .
4. Run the same query with option(index name damAssetLucene-12-custom-1) . It
works.
Expected:
Tag values with - and . are accepted, the same way index names are, and the
index whose tags contain that value is selected.
Actual:
The query is rejected with a parse error before index selection happens.
Cause:
The tag value is checked against [a-zA-Z0-9_]* . Index names are not checked
this way.
Proposed fix:
Allow - and . in index tag values. Keep the existing length limit, and keep
rejecting other characters. Update the documentation ( query-engine.md ) to
match.
was:
An index can be given tags with the tags property, and a query can then
select it with option(index tag ...) . However, the query parser only accepts
the characters a-z, A-Z, 0-9, _ in the tag value. Any tag with a hyphen ( - )
or a dot ( . ) is rejected as a syntax error, even when it exactly matches a
tag configured on the index.
Index names have no such restriction. option(index name ...) works with names
that contain these characters, for example damAssetLucene-12-custom-1 .
Steps to reproduce:
1. Configure an index with:
{code}
"tags": ["personalization", "pages", "semantic-pages", "semantic.pages"]
{code}
2. Run a query with option(index tag pages) . It works.
3. Run the same query with option(index tag semantic-pages) or option(index
tag semantic.pages) , either bare, quoted or in brackets. It fails with a parse
error: expected: a-z, A-Z, 0-9, _ .
4. Run the same query with option(index name damAssetLucene-12-custom-1) . It
works.
Expected:
Tag values with - and . are accepted, the same way index names are, and the
index whose tags contain that value is selected.
Actual:
The query is rejected with a parse error before index selection happens.
Cause:
The tag value is checked against [a-zA-Z0-9_]* . Index names are not checked
this way.
Proposed fix:
Allow - and . in index tag values. Keep the existing length limit, and keep
rejecting other characters. Update the documentation ( query-engine.md ) to
match.
Once you've added it, I can update PR #3265 to accept . as well.
> Index tag option rejects tag values containing - or . , unlike index names
> -----------------------------------------------------------------------------
>
> Key: OAK-12509
> URL: https://issues.apache.org/jira/browse/OAK-12509
> Project: Jackrabbit Oak
> Issue Type: Task
> Components: indexing
> Affects Versions: 1.2.22
> Reporter: Paul Chibulcuteanu
> Priority: Minor
>
> An index can be given tags with the tags property, and a query can then
> select it with option(index tag ...) . However, the query parser only
> accepts the characters a-z, A-Z, 0-9, _ in the tag value. Any tag with a
> hyphen ( - ) or a dot ( . ) is rejected as a syntax error, even when it
> exactly matches a tag configured on the index.
> Index names have no such restriction. option(index name ...) works with
> names that contain these characters, for example damAssetLucene-12-custom-1 .
> Steps to reproduce:
> 1. Configure an index with:
> {code}
> "tags": ["personalization", "pages", "semantic-pages", "semantic.pages"]
> {code}
> 2. Run a query with option(index tag pages) . It works.
> 3. Run the same query with option(index tag semantic-pages) or
> option(index tag semantic.pages) , either bare, quoted or in brackets. It
> fails with a parse error: expected: a-z, A-Z, 0-9, _ .
> 4. Run the same query with option(index name damAssetLucene-12-custom-1) .
> It works.
> Expected:
> Tag values with - and . are accepted, the same way index names are, and
> the index whose tags contain that value is selected.
> Actual:
> The query is rejected with a parse error before index selection happens.
> Cause:
> The tag value is checked against [a-zA-Z0-9_]* . Index names are not checked
> this way.
> Proposed fix:
> Allow - and . in index tag values. Keep the existing length limit, and
> keep rejecting other characters. Update the documentation ( query-engine.md )
> to match.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)