[ https://issues.apache.org/jira/browse/OAK-9653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Schulze updated OAK-9653: -------------------------------- Description: I've experienced this behavior und the following circumstances: * Query with an index tag option ("option (index tag x)") * The index the tag has an regex property with REGEX_ALL_PROPS What happens is that the resulting query to lucene, which can be inspected in [1] is: {noformat} +:ancestors:/test +:indexTag:x{noformat} So the {{:indexTag}} will be added to the Lucene index as a property, because {{:indexTag}} matches the regex, which can be inspected in [2] I've added a failing unit test for this in [0], where I just copied the \{{descendantTest}} and added the IndexTag I've also tried to come around with a custom regex which excludes every node which starts with a colon ( regex: {{{}"^[^:\\/][^\\/]*$"{}}}). This leads to another problem where the index won't be selected and the query will traverse. [0] [https://github.com/apache/jackrabbit-oak/pull/448/files] [1] [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java#L340] [2] [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java#L1500] was: I've experienced this behavior und the following circumstances: * Query with an index tag option ("option (index tag x)") * The index the tag has an regex property with REGEX_ALL_PROPS What happens is that the resulting query to lucene, which can be inspected in [1] is: {noformat} +:ancestors:/test +:indexTag:x{noformat} So the \{{:indexTag}} will be added to the Lucene index as a property, because {{:indexTag}} matches the regex, which can be inspected in [2] I've added a failing unit test for this in [0]. I've also tried to come around with a custom regex which excludes every node which starts with a colon ( regex: {{"^[^:\\/][^\\/]*$"}}). This leads to another problem where the index won't be selected and the query will traverse. [0] [https://github.com/apache/jackrabbit-oak/pull/448/files] [1] [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java#L340] [2] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java#L1500 > Adding the index tag option interferes with regex properties, leads to return > zero results > ------------------------------------------------------------------------------------------ > > Key: OAK-9653 > URL: https://issues.apache.org/jira/browse/OAK-9653 > Project: Jackrabbit Oak > Issue Type: Bug > Components: indexing > Affects Versions: 1.40.0 > Reporter: Martin Schulze > Priority: Major > > I've experienced this behavior und the following circumstances: > * Query with an index tag option ("option (index tag x)") > * The index the tag has an regex property with REGEX_ALL_PROPS > What happens is that the resulting query to lucene, which can be inspected in > [1] is: > {noformat} > +:ancestors:/test +:indexTag:x{noformat} > So the {{:indexTag}} will be added to the Lucene index as a property, because > {{:indexTag}} matches the regex, which can be inspected in [2] > I've added a failing unit test for this in [0], where I just copied the > \{{descendantTest}} and added the IndexTag > I've also tried to come around with a custom regex which excludes every node > which starts with a colon ( regex: {{{}"^[^:\\/][^\\/]*$"{}}}). This leads to > another problem where the index won't be selected and the query will traverse. > [0] [https://github.com/apache/jackrabbit-oak/pull/448/files] > [1] > [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java#L340] > [2] > [https://github.com/apache/jackrabbit-oak/blob/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java#L1500] -- This message was sent by Atlassian Jira (v8.20.1#820001)