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 Alex Parvulescu <al...@gmail.com> on 2012/10/29 10:33:07 UTC

Re: svn commit: r1402036 - in /jackrabbit/oak/trunk: oak-core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ oak-core/src/main/java/org/apache/jackrabbit/oak/plu

Hi,

Good point, if you use this index alone, it will probably not work anymore.
But, all the index implementations make all the changes on the builder
param that is managed by the IndexHookManager.

In the end, the index impls will not extend CommitHook (but rather
IndexHook) and will only be used via the IndexHookManager.

best,
alex



On Mon, Oct 29, 2012 at 10:19 AM, Marcel Reutegger <mr...@adobe.com>wrote:

> Hi,
>
> I don't think below will work as expected. The PropertyIndexHook now
> simply returns the 'unmodified' after state. Instead it should return
> the state (from the builder) after it did the modifications. Basically what
> the code did in the previous version.
>
> Regards
>  Marcel
>
> > Modified: jackrabbit/oak/trunk/oak-
> > core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> > pertyIndexHook.java
> > URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-
> > core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> > pertyIndexHook.java?rev=1402036&r1=1402035&r2=1402036&view=diff
> > ==========================================================
> > ====================
> > --- jackrabbit/oak/trunk/oak-
> > core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> > pertyIndexHook.java (original)
> > +++ jackrabbit/oak/trunk/oak-
> > core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/Pro
> > pertyIndexHook.java Thu Oct 25 09:13:00 2012
> > @@ -22,27 +22,31 @@ import java.util.Map;
> >  import javax.annotation.Nonnull;
> >
> >  import org.apache.jackrabbit.oak.api.CommitFailedException;
> > -import org.apache.jackrabbit.oak.spi.commit.CommitHook;
> > +import org.apache.jackrabbit.oak.plugins.index.IndexHook;
> >  import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
> >  import org.apache.jackrabbit.oak.spi.state.NodeState;
> >
> >  import com.google.common.collect.Maps;
> >
> >  /**
> > - * {@link CommitHook} implementation that is responsible for keeping the
> > + * {@link IndexHook} implementation that is responsible for keeping the
> >   * {@link PropertyIndex} up to date
> >   *
> >   * @see PropertyIndex
> >   * @see PropertyIndexLookup
> >   *
> >   */
> > -public class PropertyIndexHook implements CommitHook {
> > +public class PropertyIndexHook implements IndexHook {
> > +
> > +    private final NodeBuilder builder;
> > +
> > +    public PropertyIndexHook(NodeBuilder builder) {
> > +        this.builder = builder;
> > +    }
> >
> >      @Override @Nonnull
> >      public NodeState processCommit(NodeState before, NodeState after)
> >              throws CommitFailedException {
> > -        NodeBuilder builder = after.builder();
> > -
> >          Map<String, List<PropertyIndexUpdate>> indexes =
> > Maps.newHashMap();
> >          PropertyIndexDiff diff = new PropertyIndexDiff(builder,
> indexes);
> >          after.compareAgainstBaseState(before, diff);
> > @@ -53,7 +57,7 @@ public class PropertyIndexHook implement
> >              }
> >          }
> >
> > -        return builder.getNodeState();
> > +        return after;
> >      }
>

RE: svn commit: r1402036 - in /jackrabbit/oak/trunk: oak-core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ oak-core/src/main/java/org/apache/jackrabbit/oak/plu

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

> Good point, if you use this index alone, it will probably not work anymore.

I can confirm that. I discovered it when I ran PropertyIndexTest. The
PropertyIndexLookup does not pick up the configuration because of this.

I'll fix it together with OAK-403.

Regards
 Marcel