[ 
https://issues.apache.org/jira/browse/OAK-2240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14190065#comment-14190065
 ] 

Alex Parvulescu commented on OAK-2240:
--------------------------------------

it looks like the current version is a bit eager in marking the parent indexers 
as dirty in the case there's no match on the relative path.
Here's an improved version of the _markParentsOnRelPropChange_ method:
{code}
    private void markParentsOnRelPropChange() {
        for (RelativeProperty rp : changedRelativeProps) {
            LuceneIndexEditor p = this;
            for (String parentName : rp.ancestors) {
                if (p == null || !p.name.equals(parentName)) {
                    p = null;
                    break;
                }
                p = p.parent;
            }
            if (p != null) {
                p.markPropertiesChanged();
            }
        }
    }
{code}
Changes are: _LuceneIndexEditor p = this;_ and _p = null_ .

> Support for indexing relative properties
> ----------------------------------------
>
>                 Key: OAK-2240
>                 URL: https://issues.apache.org/jira/browse/OAK-2240
>             Project: Jackrabbit Oak
>          Issue Type: Sub-task
>          Components: oak-lucene
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: 1.0.8, 1.2
>
>         Attachments: OAK-2240.patch
>
>
> Lucene property index needs to support following queries which make use of 
> relative properties
> {noformat}
> select [jcr:path], [jcr:score], * from [dam:Asset] as a 
> where [jcr:content/jcr:lastModified] > cast('2014-10-01T00:00:00.000+02:00' 
> as date)
> {noformat}
> Possible Approach
> # Have the index definition define a property like foo/bar
> # LuceneIndexEditor would also index child property foo/bar as part of parent 
> node if present
> # On update in child the child node can indicate the parent to make the 
> document again
> # On query side the property restriction can be used listerall i.e. foo/bar 
> and stuff should work fine



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to