Control Property Indexing in Alfresco

Alfresco content model allow us to create and manage custom content types in alfresco. We are not going to get into details of how to create custom content model because it is already explained in this previous post. In my previous post regarding manage indexing behavior of property in alfresco we had seen way to enable and disable indexing for particular document. Now we will go into one more level deep and see how we can manage indexing behavior of particular property. When Lucene index particular document all properties associated with that are also gets indexed.

As per the content model DTD property definition tag support three different attributes through which we can control indexing of property in alfresco.

<xs:complexType name="property">

     <xs:sequence>

         <xs:group ref="dd:TextualDescription" />

         <xs:element name="type" type="xs:string"/>

         <xs:element name="protected" type="xs:boolean"

           maxOccurs="1" minOccurs="0" />

       <xs:element name="mandatory"

           maxOccurs="1" minOccurs="0" type="dd:mandatoryDef" >

         </xs:element>

         <xs:element name="multiple" type="xs:boolean"

           maxOccurs="1" minOccurs="0" />

         <xs:element name="default" type="xs:anyType"

           maxOccurs="1" minOccurs="0" />

         <xs:element name="index" maxOccurs="1" minOccurs="0">

           <xs:complexType>

               <xs:sequence>

                 <xs:element name="atomic" type="xs:boolean"

                    maxOccurs="1" minOccurs="0" />

                 <xs:element name="stored" type="xs:boolean"

                     maxOccurs="1" minOccurs="0" />

                 <xs:element name="tokenised"

                     maxOccurs="1" minOccurs="0" >

                       <xs:simpleType>

                           <xs:restriction base="xs:string">

                             <xs:enumeration value="true"/>

                             <xs:enumeration value="false"/>

                             <xs:enumeration value="both"/>

                           </xs:restriction>

                       </xs:simpleType>

                     </xs:element>

               </xs:sequence>

               <xs:attribute name="enabled" type="xs:boolean"

                  use="required" />

           </xs:complexType>

         </xs:element>

 

In your custom content model it will look like this

 

 <property name="custom:customProperty">        
       <type>d:text</type>      
         <mandatory>false</mandatory>
         <index enabled="true">   
              <atomic>false</atomic>   
              <stored>false</stored> 
              <tokenised>true</tokenised>        
         </index>    
</property>

To enable the content repository to query on a property value, the property must first be indexed, which is controlled via the index element. Choose which properties are indexed carefully, as each property will increase the size of the index.  Let us see each of those tags one by one.

<index enabled=”true”>

This will decide whether indexing should be enabled for property or not.

<atomic>false</atomic>  

This tag decides property should be indexed as part of the transaction commits (known as atomic indexing) or indexed in the background. Typically, properties of type d:content are background-indexed because those are heavy operations and will take time. Tokenization is the process used by the query engine for recognizing words and other elements, such as punctuation. Control over how values are tokenized is also possible, following two tags are used to control tokenization behavior.

<stored>false</stored>

<tokenised>true</tokenised>

This tag decide whether only the tokenized value is stored in the index, or only the original value is stored in the index, or both.  To index both tokenised tag look like this. <tokenised>both</tokenised>

So, this is all about managing property indexing in alfresco. Hope this helps readers to understand indexing.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *