You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Vishal Seth <vi...@mastek.com> on 2009/01/28 07:20:46 UTC

How do I configure Index Rules when using OCM

Hi,

I am trying to configure the index rules for jackrabbit where I am using OCM to persist my data.

My understanding so far is that JackRabbit would index everything unless we specify specific rules as part of index configuration. I need specific indexes to improve the start time for a repository.

Once I define the index rules I am unable to retrieve the data.

I am attaching code snippets for index rule, jcrmapping & extracted log statements from the query execution part.

Let me know if I am missing something or is there a different way of defining index when using OCM? Is there a separate test case for the same?

In case any additional information is needed related to this then let me know.

Path for storing all the objects is "/rules/metadata"

Index rule configuration for properties is as follows:
  <index-rule nodeType="nt:unstructured">
     <property>id</property>
  </index-rule>
  <index-rule nodeType="nt:unstructured">
     <property>name</property>
  </index-rule>
  <index-rule nodeType="nt:unstructured">
     <property>className</property>
  </index-rule>
  <index-rule nodeType="nt:unstructured">
     <property>path</property>
  </index-rule>

Jcr mapping is as follows:
<class-descriptor className="com.test.TestVO" jcrType="nt:unstructured" >
          <field-descriptor fieldName="id" jcrName="id" id="true" />
          <field-descriptor fieldName="name"  jcrName="name"  />
          <field-descriptor fieldName="path"  path="true" />
<field-descriptor fieldName="prop1"  jcrName="prop1"  />
<field-descriptor fieldName="prop2"  jcrName="prop2"  />
<field-descriptor fieldName="prop3"  jcrName="prop3"  />
<field-descriptor fieldName="prop4"  jcrName="prop4"  />
</class-descriptor>

Relevant log statements from log file

2009-01-28 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|/jcr:root/rules/element(metadata, nt:unstructured) [@ocm_classname='com.test.TestVO']
2009-01-28 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get Objects with expression : /jcr:root/rules/element(metadata, nt:unstructured) [@ocm_classname='com.test.TestVO'] and language xpath
2009-01-28 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get Node Iterator with expression /jcr:root/rules/element(metadata, nt:unstructured) [@ocm_classname='com.test.TestVO'] and language xpath
2009-01-28 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryImpl|Executing query:
+ Root node
+ Select properties: *
  + PathQueryNode
    + LocationStepQueryNode:  NodeTest={} Descendants=false Index=NONE
    + LocationStepQueryNode:  NodeTest={}rules Descendants=false Index=NONE
    + LocationStepQueryNode:  NodeTest={}metadata Descendants=false Index=NONE
      + NodeTypeQueryNode:  Prop={http://www.jcp.org/jcr/1.0}primaryType Value={http://www.jcp.org/jcr/nt/1.0}unstructured
      + RelationQueryNode: Op: = Prop=@{}ocm_classname Type=STRING Value=com.test.TestVO


2009-01-28 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder|Coerced com.test.TestVO into NAME.
2009-01-28 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|getResults(2147483647) limit=0
2009-01-28 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|query executed in 16 ms
2009-01-28 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|retrieved ScoreNodes in 0 ms

Regards,
Vishal
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RE: How do I configure Index Rules when using OCM

Posted by Vishal Seth <vi...@mastek.com>.
Is there a way to know that indexes have been created on rules mentioned as per the config file?

Regards
Vishal


-----Original Message-----
From: Marcel Reutegger [mailto:marcel.reutegger@gmx.net]
Sent: Wednesday, January 28, 2009 7:04 PM
To: users@jackrabbit.apache.org
Subject: Re: How do I configure Index Rules when using OCM

Vishal Seth wrote:
> Index rule configuration for properties is as follows:
>   <index-rule nodeType="nt:unstructured">
>      <property>id</property>
>   </index-rule>
>   <index-rule nodeType="nt:unstructured">
>      <property>name</property>
>   </index-rule>
>   <index-rule nodeType="nt:unstructured">
>      <property>className</property>
>   </index-rule>
>   <index-rule nodeType="nt:unstructured">
>      <property>path</property>
>   </index-rule>

this won't work. the query handler will always pick the first index-rule that
matches (see also http://wiki.apache.org/jackrabbit/IndexingConfiguration). that
is, if you have a node of type nt:unstructured then always the first index-rule
will be chosen. all other rules will be ignored. I guess what you rather want is:

  <index-rule nodeType="nt:unstructured">
     <property>id</property>
     <property>name</property>
     <property>ocm_classname</property>
     <property>path</property>
  </index-rule>


however I doubt that this will have a significant impact on the startup time of
the repository. do you have profiling data that indicates that startup is slow
due to the size of the index?

regards
 marcel


MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: How do I configure Index Rules when using OCM

Posted by Marcel Reutegger <ma...@gmx.net>.
Vishal Seth wrote:
> Index rule configuration for properties is as follows:
>   <index-rule nodeType="nt:unstructured">
>      <property>id</property>
>   </index-rule>
>   <index-rule nodeType="nt:unstructured">
>      <property>name</property>
>   </index-rule>
>   <index-rule nodeType="nt:unstructured">
>      <property>className</property>
>   </index-rule>
>   <index-rule nodeType="nt:unstructured">
>      <property>path</property>
>   </index-rule>

this won't work. the query handler will always pick the first index-rule that
matches (see also http://wiki.apache.org/jackrabbit/IndexingConfiguration). that
is, if you have a node of type nt:unstructured then always the first index-rule
will be chosen. all other rules will be ignored. I guess what you rather want is:

  <index-rule nodeType="nt:unstructured">
     <property>id</property>
     <property>name</property>
     <property>ocm_classname</property>
     <property>path</property>
  </index-rule>


however I doubt that this will have a significant impact on the startup time of
the repository. do you have profiling data that indicates that startup is slow
due to the size of the index?

regards
 marcel

Re: How do I configure Index Rules when using OCM

Posted by Christophe Lombart <ch...@gmail.com>.
Sorry I made an error in my previous mail.

>From OCM 1.5, you have to use the "ocm_classname" , change this in the node
type definition and in index-rule.
Don't forget to test with a new empty repository.

So try to use :

<nodeType name="ocm:discriminator" isMixin="true">
    <supertypes>
      <supertype>nt:base</supertype>
    </supertypes>
    <propertyDefinition name="ocm_classname" requiredType="String"
autoCreated="false" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false" />
  </nodeType>


and for the index :


 <index-rule nodeType="nt:unstructured">
   <property>ocm_classname</property>
 </index-rule>


2009/1/28 Vishal Seth <vi...@mastek.com>

> Thanks. I have already tried this but in vain. I have also tried creating
> an index rule with ocm:discriminator & property ocm:classname.
>
> One more thing,  my node types are registered as follows:
>
> <nodeType name="ocm:discriminator" isMixin="true">
>                <supertypes>
>                        <supertype>nt:base</supertype>
>                </supertypes>
>                <propertyDefinition name="ocm:classname"
> requiredType="String" autoCreated="false" mandatory="true"
> onParentVersion="COPY" protected="false" multiple="false"/>
>        </nodeType>
>
> Regards
> Vishal
>
> -----Original Message-----
> From: Christophe Lombart [mailto:christophe.lombart@gmail.com]
> Sent: Wednesday, January 28, 2009 2:42 PM
> To: users@jackrabbit.apache.org
> Subject: Re: How do I configure Index Rules when using OCM
>
> Hi,
>
> I'm not a Jackrabbit index config expert but I'm wondering if it is not an
> error in the index-rule config, try to replace
>  <index-rule nodeType="nt:unstructured">
>    <property>className</property>
>  </index-rule>
>
> by
>
>  <index-rule nodeType="nt:unstructured">
>    <property>ocm_classname</property>
>  </index-rule>
>
>
> Hope this help,
> Christophe
>
> 2009/1/28 Vishal Seth <vi...@mastek.com>
>
> > Hi,
> >
> > I am trying to configure the index rules for jackrabbit where I am using
> > OCM to persist my data.
> >
> > My understanding so far is that JackRabbit would index everything unless
> we
> > specify specific rules as part of index configuration. I need specific
> > indexes to improve the start time for a repository.
> >
> > Once I define the index rules I am unable to retrieve the data.
> >
> > I am attaching code snippets for index rule, jcrmapping & extracted log
> > statements from the query execution part.
> >
> > Let me know if I am missing something or is there a different way of
> > defining index when using OCM? Is there a separate test case for the
> same?
> >
> > In case any additional information is needed related to this then let me
> > know.
> >
> > Path for storing all the objects is "/rules/metadata"
> >
> > Index rule configuration for properties is as follows:
> >  <index-rule nodeType="nt:unstructured">
> >     <property>id</property>
> >  </index-rule>
> >  <index-rule nodeType="nt:unstructured">
> >     <property>name</property>
> >  </index-rule>
> >  <index-rule nodeType="nt:unstructured">
> >     <property>className</property>
> >  </index-rule>
> >  <index-rule nodeType="nt:unstructured">
> >     <property>path</property>
> >  </index-rule>
> >
> > Jcr mapping is as follows:
> > <class-descriptor className="com.test.TestVO" jcrType="nt:unstructured" >
> >          <field-descriptor fieldName="id" jcrName="id" id="true" />
> >          <field-descriptor fieldName="name"  jcrName="name"  />
> >          <field-descriptor fieldName="path"  path="true" />
> > <field-descriptor fieldName="prop1"  jcrName="prop1"  />
> > <field-descriptor fieldName="prop2"  jcrName="prop2"  />
> > <field-descriptor fieldName="prop3"  jcrName="prop3"  />
> > <field-descriptor fieldName="prop4"  jcrName="prop4"  />
> > </class-descriptor>
> >
> > Relevant log statements from log file
> >
> > 2009-01-28
> >
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|/jcr:root/rules/element(metadata,
> > nt:unstructured) [@ocm_classname='com.test.TestVO']
> > 2009-01-28
> >
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get
> > Objects with expression : /jcr:root/rules/element(metadata,
> nt:unstructured)
> > [@ocm_classname='com.test.TestVO'] and language xpath
> > 2009-01-28
> >
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get
> > Node Iterator with expression /jcr:root/rules/element(metadata,
> > nt:unstructured) [@ocm_classname='com.test.TestVO'] and language xpath
> > 2009-01-28
> >
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryImpl|Executing
> > query:
> > + Root node
> > + Select properties: *
> >  + PathQueryNode
> >    + LocationStepQueryNode:  NodeTest={} Descendants=false Index=NONE
> >    + LocationStepQueryNode:  NodeTest={}rules Descendants=false
> Index=NONE
> >    + LocationStepQueryNode:  NodeTest={}metadata Descendants=false
> > Index=NONE
> >      + NodeTypeQueryNode:  Prop={http://www.jcp.org/jcr/1.0}primaryType<http://www.jcp.org/jcr/1.0%7DprimaryType>
> <http://www.jcp.org/jcr/1.0%7DprimaryType>Value={
> > http://www.jcp.org/jcr/nt/1.0}unstructured<http://www.jcp.org/jcr/nt/1.0%7Dunstructured>
> <http://www.jcp.org/jcr/nt/1.0%7Dunstructured>
> >      + RelationQueryNode: Op: = Prop=@{}ocm_classname Type=STRING
> > Value=com.test.TestVO
> >
> >
> > 2009-01-28
> >
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder|Coerced
> > com.test.TestVO into NAME.
> > 2009-01-28
> >
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|getResults(2147483647)
> > limit=0
> > 2009-01-28
> >
> 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|query
> > executed in 16 ms
> > 2009-01-28
> >
> 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|retrieved
> > ScoreNodes in 0 ms
> >
> > Regards,
> > Vishal
> > MASTEK LTD.
> > Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
> > In the US, we're called MAJESCOMASTEK
> >
> >
> >
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Opinions expressed in this e-mail are those of the individual and not
> that
> > of Mastek Limited, unless specifically indicated to that effect. Mastek
> > Limited does not accept any responsibility or liability for it. This
> e-mail
> > and attachments (if any) transmitted with it are confidential and/or
> > privileged and solely for the use of the intended person or entity to
> which
> > it is addressed. Any review, re-transmission, dissemination or other use
> of
> > or taking of any action in reliance upon this information by persons or
> > entities other than the intended recipient is prohibited. This e-mail and
> > its attachments have been scanned for the presence of computer viruses.
> It
> > is the responsibility of the recipient to run the virus check on e-mails
> and
> > attachments before opening them. If you have received this e-mail in
> error,
> > kindly delete this e-mail from desktop and server.
> >
> >
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
>
> MASTEK LTD.
> Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails and
> attachments before opening them. If you have received this e-mail in error,
> kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>

RE: How do I configure Index Rules when using OCM

Posted by Vishal Seth <vi...@mastek.com>.
Thanks. I have already tried this but in vain. I have also tried creating an index rule with ocm:discriminator & property ocm:classname.

One more thing,  my node types are registered as follows:

<nodeType name="ocm:discriminator" isMixin="true">
                <supertypes>
                        <supertype>nt:base</supertype>
                </supertypes>
                <propertyDefinition name="ocm:classname" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
        </nodeType>

Regards
Vishal

-----Original Message-----
From: Christophe Lombart [mailto:christophe.lombart@gmail.com]
Sent: Wednesday, January 28, 2009 2:42 PM
To: users@jackrabbit.apache.org
Subject: Re: How do I configure Index Rules when using OCM

Hi,

I'm not a Jackrabbit index config expert but I'm wondering if it is not an
error in the index-rule config, try to replace
 <index-rule nodeType="nt:unstructured">
    <property>className</property>
 </index-rule>

by

 <index-rule nodeType="nt:unstructured">
    <property>ocm_classname</property>
 </index-rule>


Hope this help,
Christophe

2009/1/28 Vishal Seth <vi...@mastek.com>

> Hi,
>
> I am trying to configure the index rules for jackrabbit where I am using
> OCM to persist my data.
>
> My understanding so far is that JackRabbit would index everything unless we
> specify specific rules as part of index configuration. I need specific
> indexes to improve the start time for a repository.
>
> Once I define the index rules I am unable to retrieve the data.
>
> I am attaching code snippets for index rule, jcrmapping & extracted log
> statements from the query execution part.
>
> Let me know if I am missing something or is there a different way of
> defining index when using OCM? Is there a separate test case for the same?
>
> In case any additional information is needed related to this then let me
> know.
>
> Path for storing all the objects is "/rules/metadata"
>
> Index rule configuration for properties is as follows:
>  <index-rule nodeType="nt:unstructured">
>     <property>id</property>
>  </index-rule>
>  <index-rule nodeType="nt:unstructured">
>     <property>name</property>
>  </index-rule>
>  <index-rule nodeType="nt:unstructured">
>     <property>className</property>
>  </index-rule>
>  <index-rule nodeType="nt:unstructured">
>     <property>path</property>
>  </index-rule>
>
> Jcr mapping is as follows:
> <class-descriptor className="com.test.TestVO" jcrType="nt:unstructured" >
>          <field-descriptor fieldName="id" jcrName="id" id="true" />
>          <field-descriptor fieldName="name"  jcrName="name"  />
>          <field-descriptor fieldName="path"  path="true" />
> <field-descriptor fieldName="prop1"  jcrName="prop1"  />
> <field-descriptor fieldName="prop2"  jcrName="prop2"  />
> <field-descriptor fieldName="prop3"  jcrName="prop3"  />
> <field-descriptor fieldName="prop4"  jcrName="prop4"  />
> </class-descriptor>
>
> Relevant log statements from log file
>
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|/jcr:root/rules/element(metadata,
> nt:unstructured) [@ocm_classname='com.test.TestVO']
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get
> Objects with expression : /jcr:root/rules/element(metadata, nt:unstructured)
> [@ocm_classname='com.test.TestVO'] and language xpath
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get
> Node Iterator with expression /jcr:root/rules/element(metadata,
> nt:unstructured) [@ocm_classname='com.test.TestVO'] and language xpath
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryImpl|Executing
> query:
> + Root node
> + Select properties: *
>  + PathQueryNode
>    + LocationStepQueryNode:  NodeTest={} Descendants=false Index=NONE
>    + LocationStepQueryNode:  NodeTest={}rules Descendants=false Index=NONE
>    + LocationStepQueryNode:  NodeTest={}metadata Descendants=false
> Index=NONE
>      + NodeTypeQueryNode:  Prop={http://www.jcp.org/jcr/1.0}primaryType<http://www.jcp.org/jcr/1.0%7DprimaryType>Value={
> http://www.jcp.org/jcr/nt/1.0}unstructured<http://www.jcp.org/jcr/nt/1.0%7Dunstructured>
>      + RelationQueryNode: Op: = Prop=@{}ocm_classname Type=STRING
> Value=com.test.TestVO
>
>
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder|Coerced
> com.test.TestVO into NAME.
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|getResults(2147483647)
> limit=0
> 2009-01-28
> 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|query
> executed in 16 ms
> 2009-01-28
> 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|retrieved
> ScoreNodes in 0 ms
>
> Regards,
> Vishal
> MASTEK LTD.
> Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails and
> attachments before opening them. If you have received this e-mail in error,
> kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: How do I configure Index Rules when using OCM

Posted by Christophe Lombart <ch...@gmail.com>.
Hi,

I'm not a Jackrabbit index config expert but I'm wondering if it is not an
error in the index-rule config, try to replace
 <index-rule nodeType="nt:unstructured">
    <property>className</property>
 </index-rule>

by

 <index-rule nodeType="nt:unstructured">
    <property>ocm_classname</property>
 </index-rule>


Hope this help,
Christophe

2009/1/28 Vishal Seth <vi...@mastek.com>

> Hi,
>
> I am trying to configure the index rules for jackrabbit where I am using
> OCM to persist my data.
>
> My understanding so far is that JackRabbit would index everything unless we
> specify specific rules as part of index configuration. I need specific
> indexes to improve the start time for a repository.
>
> Once I define the index rules I am unable to retrieve the data.
>
> I am attaching code snippets for index rule, jcrmapping & extracted log
> statements from the query execution part.
>
> Let me know if I am missing something or is there a different way of
> defining index when using OCM? Is there a separate test case for the same?
>
> In case any additional information is needed related to this then let me
> know.
>
> Path for storing all the objects is "/rules/metadata"
>
> Index rule configuration for properties is as follows:
>  <index-rule nodeType="nt:unstructured">
>     <property>id</property>
>  </index-rule>
>  <index-rule nodeType="nt:unstructured">
>     <property>name</property>
>  </index-rule>
>  <index-rule nodeType="nt:unstructured">
>     <property>className</property>
>  </index-rule>
>  <index-rule nodeType="nt:unstructured">
>     <property>path</property>
>  </index-rule>
>
> Jcr mapping is as follows:
> <class-descriptor className="com.test.TestVO" jcrType="nt:unstructured" >
>          <field-descriptor fieldName="id" jcrName="id" id="true" />
>          <field-descriptor fieldName="name"  jcrName="name"  />
>          <field-descriptor fieldName="path"  path="true" />
> <field-descriptor fieldName="prop1"  jcrName="prop1"  />
> <field-descriptor fieldName="prop2"  jcrName="prop2"  />
> <field-descriptor fieldName="prop3"  jcrName="prop3"  />
> <field-descriptor fieldName="prop4"  jcrName="prop4"  />
> </class-descriptor>
>
> Relevant log statements from log file
>
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|/jcr:root/rules/element(metadata,
> nt:unstructured) [@ocm_classname='com.test.TestVO']
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get
> Objects with expression : /jcr:root/rules/element(metadata, nt:unstructured)
> [@ocm_classname='com.test.TestVO'] and language xpath
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl|Get
> Node Iterator with expression /jcr:root/rules/element(metadata,
> nt:unstructured) [@ocm_classname='com.test.TestVO'] and language xpath
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryImpl|Executing
> query:
> + Root node
> + Select properties: *
>  + PathQueryNode
>    + LocationStepQueryNode:  NodeTest={} Descendants=false Index=NONE
>    + LocationStepQueryNode:  NodeTest={}rules Descendants=false Index=NONE
>    + LocationStepQueryNode:  NodeTest={}metadata Descendants=false
> Index=NONE
>      + NodeTypeQueryNode:  Prop={http://www.jcp.org/jcr/1.0}primaryType<http://www.jcp.org/jcr/1.0%7DprimaryType>Value={
> http://www.jcp.org/jcr/nt/1.0}unstructured<http://www.jcp.org/jcr/nt/1.0%7Dunstructured>
>      + RelationQueryNode: Op: = Prop=@{}ocm_classname Type=STRING
> Value=com.test.TestVO
>
>
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder|Coerced
> com.test.TestVO into NAME.
> 2009-01-28
> 11:27:23,446|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|getResults(2147483647)
> limit=0
> 2009-01-28
> 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|query
> executed in 16 ms
> 2009-01-28
> 11:27:23,462|DEBUG|main|org.apache.jackrabbit.core.query.lucene.QueryResultImpl|retrieved
> ScoreNodes in 0 ms
>
> Regards,
> Vishal
> MASTEK LTD.
> Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails and
> attachments before opening them. If you have received this e-mail in error,
> kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>