dhartford
dhartford

Reputation: 1149

Alfresco disable full text indexing on specific content model

Using Alfresco 4.2 or 5.0, how do you disable full text indexing on a content-model basis?

Here is an example content model, what do you change specifically (i.e. do not reference the index control aspect without how to actually use it with a content model).

<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
    <import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
    <import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
    <namespace prefix="my"
        uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
 <parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
 <title>custom key word text field</title>
 <type>d:text</type>
 <mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>

FINAL ANSWER

<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
    <import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
    <import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
    <namespace prefix="my"
        uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
 <parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
 <title>custom key word text field</title>
 <type>d:text</type>
 <mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>my:doNotIndexContentControl</aspect>
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
    <aspect name="my:doNotIndexContentControl">
        <title>Do Not Index Control</title>
        <parent>cm:indexControl</parent>
        <overrides>
            <property name="cm:isIndexed">
                <default>true</default>
            </property>
            <property name="cm:isContentIndexed">
                <default>false</default>
            </property>
        </overrides>
    </aspect>
</aspects>
</model>

Important Note: If you get "Source node class has no callback" errors, this is related to changing the content model and then trying to update (likely versionable) existing content. No known workaround, but this is unrelated to index control options.

Upvotes: 2

Views: 2559

Answers (2)

gbags
gbags

Reputation: 193

You can achieve this by defining a new aspect that extends cm:indexControl like so:

<aspect name="my:doNotIndexContentControl">
    <title>Do Not Index Control</title>
    <parent>cm:indexControl</parent>
    <overrides>
        <property name="cm:isIndexed">
           <default>true</default>
        </property>
        <property name="cm:isContentIndexed">
           <default>false</default>
        </property>
    </overrides>
</aspect>

Note the overrides. The overridden property, cm:isContentIndexed, with default value set to false is key.

You then add this aspect as mandatory for the types which you do not wish to full text index the content. The full configuration options for cm:indexControl can be found in the documentation http://docs.alfresco.com/4.2/concepts/admin-indexes.html

Also, if you have existing content items that have already been indexed and you want those documents to no longer be indexed, you will need to do a full re-index.

Upvotes: 6

Gagravarr
Gagravarr

Reputation: 48376

This is covered in the Data Dictionary guide on the Alfresco wiki

All you need to do is all this to your model:

<index enabled="false" />

If you look at something like the Alfresco system model, you'll see several examples of that

Upvotes: 1

Related Questions