Self-defining classes

You know that to define an “index”, you are asked to declare in XML all the custom tags that need to be indexed.

This can be quite tedious, especially in cases where you have a large amount of metadata and you want to index them all.

This is the purpose of the auto-tagging classes: they allow you to automatically detect all indexable custom tags against a data source.

By default, the self-definition classes we manage are in charge of searching all the system custom tags linked to the data source and all the specific custom tags; we could however imagine classes restricting themselves to certain tags, certain types of tags, …

XML positioning

At the XML level, the self-definition declaration is done under the index, at the same place where you could define your custom tags.

Once your self-definition class is declared, you can launch your indexing and then use your customtags in your searches as if you had manually referenced them in the index.

Declaring an autodefinition class does not prevent you from also manually declaring custom tags that are not managed by the autodefinition class.

For more information on the different indexing classes available, see here.

CUSTOMTAGS_EXCEPTIONS: we can pass parameters to our autodefinition classes. Among these parameters, we can pass a CUSTOMTAGS_EXCEPTIONS parameter which allows us to fill in one or more custom tags (names separated by “|”) which should not be indexed, even if the autodefinition class managed them natively.

Example of a declaration:

<indexes>
    <index name="IndexProcessus"
           label="LG_IndexProcessus"
           controller="com.axemble.axvdocsearch.core.controllers.implementation.LuceneController"
           extension="com.axemble.axvdocsearch.extensions.base.implementation.BaseVDPJProcessResourceIndexExtension"
           indexStorePath="vdocsearch\IndexProcessus"
           updateOnIndexedDocuments="true"
           locales="fr" >

        <parameters>
            <parameter key="CONTEXT_LOGIN" value="sysadmin" />
            <parameter key="ORGANIZATION_NAME" value="DefaultOrganization" />
            <parameter key="PROJECT_NAME" value="DefaultProject" />
            <parameter key="CATALOG_NAME" value="DefaultCatalog" />
            <parameter key="RESOURCE_DEFINITION_NAME" value="IndexProcessus_1.0" />
        </parameters>

        <autodefinitions>
            <autodefinition name="com.axemble.axvdocsearch.extensions.implementation.IAutoDefinitionExtension.ResourceAutoDefinitionExtension" />
        </autodefinitions>
    </index>

    <index name="...">
        <autodefinitions>
            <autodefinition name="com.axemble.axvdocsearch.extensions.implementation.IAutoDefinitionExtension.ResourceAutoDefinitionExtension" >
                <parameters>
                    <parameter key="CUSTOMTAGS_EXCEPTIONS" value="ChampANePasIndexer1|ChampANePasIndexer2" />
                </parameters>
            </autodefinition>
        </autodefinitions>
    </index>
</indexes>
<indexes>
    <index name="IndexProcessus"
           label="LG_IndexProcessus"
           controller="com.axemble.axvdocsearch.core.controllers.implementation.LuceneController"
           extension="com.axemble.axvdocsearch.extensions.base.implementation.BaseVDPJProcessResourceIndexExtension"
           indexStorePath="vdocsearch\IndexProcessus"
           updateOnIndexedDocuments="true"
           locales="fr" >

        <parameters>
            <parameter key="CONTEXT_LOGIN" value="sysadmin" />
            <parameter key="ORGANIZATION_NAME" value="DefaultOrganization" />
            <parameter key="PROJECT_NAME" value="DefaultProject" />
            <parameter key="CATALOG_NAME" value="DefaultCatalog" />
            <parameter key="RESOURCE_DEFINITION_NAME" value="IndexProcessus_1.0" />
        </parameters>

        <autodefinitions>
            <autodefinition name="com.axemble.axvdocsearch.extensions.base.implementation.autodefinition.ResourceAutoDefinitionExtension" />
        </autodefinitions>
    </index>

    <index name="...">
        <autodefinitions>
            <autodefinition name="com.axemble.axvdocsearch.extensions.base.implementation.autodefinition.ResourceAutoDefinitionExtension" >
                <parameters>
                    <parameter key="CUSTOMTAGS_EXCEPTIONS" value="ChampANePasIndexer1|ChampANePasIndexer2" />
                </parameters>
            </autodefinition>
        </autodefinitions>
    </index>
</indexes>

Source : https://wiki.myvdoc.net/xwiki/bin/view/Dev+Floor/HowToUseAutoDefinitionClasses