AnsweredAssumed Answered

Can't search some custom fields

Question asked by marrivato on Oct 19, 2015
I created a custom model and I was able to successfully create new fields for a node (they all appear when I look at a document's Properties). But, when I try to search for some field of the model (please see below), eg. field "my:cognome" or "my:prod_cognome" (and so on), advanced search shows 0 results found. The strange thing is that if I try to search for other fields of the same model, e.g "my:codicefiscale" or "my:prod_codicefiscale", everything work fine and advanced search shows the right results.

The fields for which the search doesn't work are rightly set and viewable from the Share interface or from nodebrowser (https://127.0.0.1/share/page/console/admin-console/node-browser)

I scoured the Internet and have tried every thing I can find, I rebuilt Alfresco content store index (index.recovery.mode=FULL) as well, but nothing was change.

Any suggestions would be appreciated!

Here is a sample of my share-config-custom.xml

<alfresco-config>

   <config replace="true">
      <flags>
         <!– Developer debugging setting to turn on DEBUG mode for client scripts
            in the browser –>
         <client-debug>false</client-debug>
         <!– LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl,
            Ctrl, Shift, Shift). This flag automatically activates logging on page load. –>
         <client-debug-autologging>false</client-debug-autologging>
      </flags>
   </config>

   <!– ServletException: Possible CSRF attack noted when comparing token in
      session and request header The CSRF filter introduced in Alfresco 4.2 blocks
      some of the web scripts used by the scripts. To avoid this behaviour, it
      must be disabled so relevant scripts can be used –>
   <config evaluator="string-compare" condition="CSRFPolicy" replace="true">
      <filter />
   </config>

   <config evaluator="string-compare" condition="DocumentLibrary">
      <aspects>
         <!– Aspects that a user can see –>
         <visible>
            <aspect name="my:archived" />
         </visible>

         <!– Aspects that a user can add. Same as "visible" if left empty –>
         <addable>
         </addable>

         <!– Aspects that a user can remove. Same as "visible" if left empty –>
         <removeable>
         </removeable>
      </aspects>

      <types>
         <type name="cm:content">
            <subtype name="my:doc" />
         </type>
      </types>

   </config>

   <!– Advanced Search extension –>
   <config replace="true" evaluator="string-compare" condition="AdvancedSearch">
      <advanced-search>
         <!– Forms for the advanced search type list –>
         <forms>
            <form labelId="search.form.label.bl_doc"
               descriptionId="search.form.desc.bl_doc">my:doc</form>
            <form labelId="search.form.label.cm_folder"
                descriptionId="search.form.desc.cm_folder">cm:folder</form>
         </forms>
      </advanced-search>
   </config>

   <config evaluator="model-type" condition="my:doc">
      <forms>
         <!– Search form –>
         <form id="search">
            <field-visibility>
               <!– Documento –>
               <show id="my:datachiusura" force="false" />
               <show id="my:iddocumento" force="false" />
               <show id="my:oggettodocumento" force="false" />
               <show id="my:tipodocumento" force="false" />
               <show id="my:utentedocumento" force="false" />
               <!– Soggetto produttore –>
               <show id="my:prod_cognome" force="false" />
               <show id="my:prod_nome" force="false" />
               <show id="my:prod_codicefiscale" force="false" />
               <show id="my:prod_ragionesociale" force="false" />
               <show id="my:prod_partitaiva" force="false" />
               <!– Destinatario –>
               <show id="my:cognome" force="false" />
               <show id="my:nome" force="false" />
               <show id="my:codicefiscale" force="false" />
               <show id="my:ragionesociale" force="false" />
            </field-visibility>
                <appearance>
                    <!– Sections –>
                  <set id="doc" appearance="bordered-panel" label-id="search.form.section.document" />
                  <set id="prod" appearance="bordered-panel" label-id="search.form.section.producer" />
                  <set id="dest" appearance="bordered-panel" label-id="search.form.section.consumer" />
                  <!– Fields –>
                    <field id="my:datachiusura" set="doc" label-id="search.form.section.date">
                        <control template="/org/alfresco/components/form/controls/daterange.ftl" />
                    </field>
               <field id="my:iddocumento" set="doc" label-id="search.form.section.id" />
               <field id="my:oggettodocumento" set="doc" label-id="search.form.section.subjct" />
               <field id="my:tipodocumento" set="doc" label-id="search.form.section.type" />
               <field id="my:utentedocumento" set="doc" label-id="search.form.section.user" />
               <!– Soggetto produttore –>
               <field id="my:prod_codicefiscale" set="prod" label-id="search.form.section.taxcode" />
               <field id="my:prod_partitaiva" set="prod" label-id="search.form.section.vat" />
               <field id="my:prod_ragionesociale" set="prod" label-id="search.form.section.company" />
               <field id="my:prod_cognome" set="prod" label-id="search.form.section.surname" />
               <field id="my:prod_nome" set="prod" label-id="search.form.section.name" />
               <!– Destinatario –>
               <field id="my:codicefiscale" set="dest" label-id="search.form.section.taxcode" />
               <field id="my:cognome" set="dest" label-id="search.form.section.surname" />
               <field id="my:nome" set="dest" label-id="search.form.section.name" />
               <field id="my:ragionesociale" set="dest" label-id="search.form.section.company" />
                </appearance>
         </form>
      </forms>
   </config>

</alfresco-config>


Here is a sample of my model:

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="my:daxorux" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    <!– Optional meta-data about the model –>
    <description>Test model</description>
    <author>daxorux</author>
    <version>1.0</version>

    <!– Imports are required to allow references to definitions in other models –>
    <imports>
        <!– Import Alfresco Dictionary Definitions –>
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
        <!– Import Alfresco Content Domain Model Definitions –>
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
    </imports>

    <!– Introduction of new namespaces defined by this model –>
    <namespaces>
        <namespace uri="http://www.daxorux.com/model/daxorux/1.0" prefix="bl" />
    </namespaces>

    <types>
        <!– Enterprise-wide generic document type –>
        <type name="my:doc">
            <title>IT Documento</title>
            <parent>cm:content</parent>
         <properties>
            <!– Documento –>
            <property name="my:datachiusura">
               <title>Data chiusura documento</title>
               <type>d:date</type>
            </property>
            <property name="my:iddocumento">
               <title>ID documento</title>
               <type>d:text</type>
            </property>
            <property name="my:oggettodocumento">
               <title>Oggetto documento</title>
               <type>d:text</type>
            </property>
            <property name="my:tipodocumento">
               <title>Tipologia documento</title>
               <type>d:text</type>
            </property>
            <property name="my:utentedocumento">
               <title>Utente documento</title>
               <type>d:text</type>
            </property>
            <!– Soggetto produttore –>
            <property name="my:prod_codicefiscale">
               <title>Codice fiscale produttore</title>
               <type>d:text</type>
            </property>
            <property name="my:prod_partitaiva">
               <title>Partita IVA produttore</title>
               <type>d:text</type>
            </property>
            <property name="my:prod_ragionesociale">
               <title>Ragione sociale produttore</title>
               <type>d:text</type>
            </property>
            <property name="my:prod_cognome">
               <title>Cognome produttore</title>
               <type>d:text</type>
            </property>
            <property name="my:prod_nome">
               <title>Nome produttore</title>
               <type>d:text</type>
            </property>
            <!– Destinatario –>
            <property name="my:codicefiscale">
               <title>Codice fiscale</title>
               <type>d:text</type>
            </property>
            <property name="my:cognome">
               <title>Cognome</title>
               <type>d:text</type>
            </property>
            <property name="my:nome">
               <title>Nome</title>
               <type>d:text</type>
            </property>
            <property name="my:ragionesociale">
               <title>Ragione sociale</title>
               <type>d:text</type>
            </property>
         </properties>
        </type>
    </types>

    <aspects>
        <aspect name="my:archived">
            <title>IT archived document</title>
            <properties>
               <property name="my:notarchived">
                   <type>d:boolean</type>
                   <default>false</default>
            </property>
         </properties>
        </aspect>
    </aspects>
</model>

Outcomes