Thanks Torgeir! I plan to scrutinize your code asap and see if there's any
new info I need to incorporate into
my own app, Seeing it done two different ways is likely to help one or more
of us! :)
​​-Clay


On Thu, Oct 29, 2015 at 8:39 AM, Torgeir Veimo <torgeir.ve...@gmail.com>
wrote:

> Additionally, you can configure a lucene full text index with (in the
> initialize method)
>
> NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
> index.child("lucene")
>     .setProperty("jcr:primaryType", "oak:QueryIndexDefinition", Type.NAME)
>     .setProperty("compatVersion", 2)
>     .setProperty("type", "lucene")
>     .setProperty("async", "async")
>     .setProperty("reindex", true)
>     .child("indexRules")
>       .setProperty("jcr:primaryType", "nt:unstructured", Type.NAME)
>       .setProperty(":childOrder", ImmutableSet.of("nt:base"), Type.STRINGS)
>       .child("nt:base")
>         .setProperty("jcr:primaryType", "nt:unstructured", Type.NAME)
>         .setProperty(":childOrder", ImmutableSet.of("properties"),
> Type.STRINGS)
>         .child("properties")
>           .setProperty("jcr:primaryType", "nt:unstructured", Type.NAME)
>           .setProperty(":childOrder", ImmutableSet.of("allProps"),
> Type.STRINGS)
>           .child("allProps")
>             .setProperty("jcr:primaryType", "oak:Unstructured", Type.NAME)
>             .setProperty("name", ".*")
>             .setProperty("isRegexp", true)
>             .setProperty("nodeScopeIndex", true);
>
> On 29 October 2015 at 23:35, Torgeir Veimo <torgeir.ve...@gmail.com>
> wrote:
> > Here's how we initialize non-lucene indexes in a spring environment;
> >
> > public class RepositoryConfiguration implements DisposableBean {
> > [...]
> > public Repository getRepository() throws ContentException {
> >   NodeStore nodeStore = null;
> >   segmentStore = new FileStore(new File(oakRepositoryPath), 256);
> >   nodeStore = new SegmentNodeStore(segmentStore);
> >
> >   oakRepository = new Jcr(nodeStore)
> >     .with(new LocalInitialContent())
> >     .withAsyncIndexing()
> >     .createRepository();
> >   return oakRepository;
> > }
> >
> > public class LocalInitialContent implements RepositoryInitializer,
> > NodeTypeConstants {
> >
> >   @SuppressWarnings("unused")
> >   private static NodeState createInitialContent() {
> >     NodeBuilder builder = EMPTY_NODE.builder();
> >     new InitialContent().initialize(builder);
> >     return ModifiedNodeState.squeeze(builder.getNodeState());
> >   }
> >
> >   @Override
> >   public void initialize(NodeBuilder builder) {
> >     // optionally set up lucene full-text index
> >
> >     createDefinition("jcr:name", index);
> >
> >     createDefinition("ka:assetType", index);
> >     [.. lots of other property indexes ..]
> >   }
> >
> >   private void createDefinition(String definition, NodeBuilder index) {
> >     IndexUtils.createIndexDefinition(index, definition, true, false,
> >       ImmutableSet.of(definition), null)
> >         .setProperty("reindex", true);
> >   }
> > }
> >
> > In addition you would want a counter index, set up something like
> >
> >     NodeBuilder entry = index.child("counter")
> >       .setProperty(JCR_PRIMARYTYPE, INDEX_DEFINITIONS_NODE_TYPE, NAME)
> >       .setProperty(TYPE_PROPERTY_NAME, "counter");
> >
> > But I haven't been able to get oak to make use of it if configured
> > this way yet.
> >
> > On 29 October 2015 at 12:48, Clay Ferguson <wcl...@gmail.com> wrote:
> >> This file shows petty much everything I know... the sum total of my
> >> knowledge on indexes! :
> >>
> https://github.com/Clay-Ferguson/meta64/blob/master/src/main/java/com/meta64/mobile/repo/OakRepository.java
> >>
> >> I was only able to cobble that code together using very scant
> information
> >> from various sources, and I *think* it works. Unless I just broke it
> with
> >> my last commit!
> >>
> >> Best regards,
> >> Clay Ferguson
> >> wcl...@gmail.com
> >>
> >>
> >> On Wed, Oct 28, 2015 at 9:20 PM, Peter Harrison <cheetah...@gmail.com>
> >> wrote:
> >>
> >>> I have moved from JackRabbit 2.X to JackRabbit Oak. I know that
> JackRabbit
> >>> Oak does not index as much as 2.X, and I am now getting the following
> >>> message in my query:
> >>>
> >>> Traversed 4000 nodes with filter ... consider creating an index or
> changing
> >>> the query.
> >>>
> >>> I have found the IndexUtils class, and some JavaDoc, but I can't see
> any
> >>> more detailed documentation on how it is used, or any examples.
> >>>
> >>> Where should I create the Index node in the tree? Does this control
> when a
> >>> property is indexed? Can you index only properties, or also node
> names? Are
> >>> node names already indexed?
> >>>
> >>> Thanks,
> >>> Peter
> >>>
> >
> >
> >
> > --
> > -Tor
>
>
>
> --
> -Tor
>

Reply via email to