You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2015/05/04 10:45:06 UTC

[jira] [Commented] (OAK-2814) Refactor the optimize logic regarding path include and exclude to avoid duplication

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

Michael Dürig commented on OAK-2814:
------------------------------------

Good catch! Patch looks good!

I would like to further clarify the Javadoc though. What about:

{code}
    /**
     * Unify path inclusions and exclusions.
     * <ul>
     * <li>A path in {@code includePaths} is only retained if {@code includePaths} contains
     * none of its ancestors and {@code excludePaths} contains neither of its ancestors nor
     * that path itself.</li>
     * <li>A path in {@code excludePaths} is only retained if {@code includePaths} contains
     * an ancestor of that path.</li>
     * </ul>
     *
     * When a set of paths is <em>filtered wrt.</em> {@code includePaths} and {@code excludePaths}
     * by first excluding all paths that have an ancestor or are contained in {@code excludePaths}
     * and then including all paths that have an ancestor or are contained in {@code includePaths}
     * then the result is the same regardless whether the {@code includePaths} and
     * {@code excludePaths} sets have been run through this method or not.   
     *
     * @param includePaths set of paths to be included
     * @param excludedPaths set of paths to be excluded
     */
{code}

Also what about changing the name to {{unifyInExcludes}}, which is crisper and more precise IMO. 

> Refactor the optimize logic regarding path include and exclude to avoid duplication
> -----------------------------------------------------------------------------------
>
>                 Key: OAK-2814
>                 URL: https://issues.apache.org/jira/browse/OAK-2814
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>            Priority: Minor
>              Labels: technical_debt
>             Fix For: 1.3.0
>
>         Attachments: OAK-2814-v1.patch
>
>
> {{ObservationManagerImpl}} has a optimize method which process the list of includes and excludes and removes redundant clauses. That logic is now also being used in index filtering (OAK-2599) and is getting duplicated.
> Going forward we need to refactor this logic so that both places can use it without copying. Possibly making it part of PathUtils
> [~mduerig] Also suggested to further optimize
> bq. Also PathFilter#optimise could be further optimised by removing entries that subsume each other (e.g. including /a/b, /a is the same as including (/a. 



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