AnsweredAssumed Answered

Share - Advanced Search - Custom Aspect

Question asked by luigi on Jan 16, 2014
Latest reply on Jan 22, 2014 by luigi
Ciao a tutti,

sto usando Alfresco Community 4.2.e su Tomcat 7.
Ho un problema in Share nella ricerca avanzata di campi custom: non riesco ad ottenere alcun risultato.

Ho aggiunto e valorizzato con successo i campi del mio custom aspect e inserito la ricerca per tipo
nella lista Advanced Search.
Ma se provo a ricercare per uno dei miei campi non ottengo risultato.

Come prova ho caricato due documenti, uno sul repository, con valore campo custom "M1"
ed uno all'interno di un sito da me creato con valore campo custom "F1".

Tramite la ricerca semplice, i documenti li trovo, inserendo però "nome del campo custom:valore", ossia
sc_codmodulo:F1 con specificato "All Sites" e sc_codmodulo:M1 con specificato "Repository".

Mi verrebbe da pensare che la mia configurazione nell'Advanced Search non abbia
un riferimento su dove andare ad effettuare la ricerca, ossia in "All Sites" o sul "Repository".
In rete ho trovato questa <a href="http://www.appnovation.com/blog/alfresco-share-search-under-folder-category">nota</a>
ma non so se abbia poi qualche attinenza al mio problema.

Quando eseguo la ricerca da Advanced Search, questo è l'url che fa l'inquire su Lucene:

http://127.0.0.1:8080/share/page/site/test/search?t=&q={'prop_sc_archiviata-date-range':'','prop_sc_codmodulo':'F1','prop_sc_codprotocollo':'','prop_sc_codfiscale':'','prop_sc_cognome':'','prop_sc_nome':'','datatype':'sc:tipomodulo'}&r=true


Avete qualche suggerimento ?

Questo è il mio customModel.xml

<?xml version="1.0" encoding="UTF-8"?>

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

<model name="sc:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Custom Model</description>
   <author></author>
   <version>1.0</version>

   <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 –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="custom.model" prefix="sc"/>    
   </namespaces>
     
<types>
        <type name="sc:tipomodulo">
            <title>Modulistica</title>
            <parent>cm:content</parent>
            <mandatory-aspects>
                <aspect>sc:protocollabile</aspect>              
            </mandatory-aspects>
        </type>     
</types>
<aspects>
    <aspect name="sc:protocollabile">
       <title>Previp Protocollo</title>
       <properties>
             <property name="sc:archiviata">
                <type>d:date</type>
                <mandatory>true</mandatory>
                </property>
             <property name="sc:codmodulo">
                   <type>d:text</type>            
                   <mandatory>true</mandatory>
             </property>
             <property name="sc:codprotocollo">
                   <type>d:text</type>            
                   <mandatory>true</mandatory>
             </property>      
             <property name="sc:codfiscale">
                   <type>d:text</type>            
                   <mandatory>true</mandatory>
             </property>      
             <property name="sc:cognome">
                   <type>d:text</type>            
                   <mandatory>true</mandatory>
             </property>      
             <property name="sc:nome">
                   <type>d:text</type>            
                   <mandatory>true</mandatory>
             </property>      
            
       </properties>
    </aspect>
   
</aspects>
     
     
</model>


E questo è il mio share-config-custom.xml:

<alfresco-config>
   <!– Document Library config section –>
   <config evaluator="string-compare" condition="DocumentLibrary">
      <aspects>
            <!– Aspects that a user can see –>
            <visible>
               <aspect name="sc:protocollabile" />            
            </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>      
   </config>

   <config evaluator="aspect" condition="sc:protocollabile">
      <forms>
         <form>
            <field-visibility>
               <show id="sc:archiviata" />
               <show id="sc:codmodulo" />
               <show id="sc:codprotocollo" />
               <show id="sc:codfiscale" />
               <show id="sc:cognome" />
               <show id="sc:nome" />
            </field-visibility>
            <appearance>
               <field id="sc:archiviata" label-id="prop.sc_archiviata" />
               <field id="sc:codmodulo" label-id="prop.sc_codmodulo" />
               <field id="sc:codprotocollo" label-id="prop.sc_codprotocollo" />
               <field id="sc:codfiscale" label-id="prop.sc_codfiscale" />
               <field id="sc:cognome" label-id="prop.sc_cognome" />
               <field id="sc:nome" label-id="prop.sc_nome" />                                                            
            </appearance>
         </form>
      </forms>
   </config>

   <config replace="true" evaluator="string-compare" condition="AdvancedSearch">
      <advanced-search>
         <!– Forms for the advanced search type list –>
         <forms>
               <form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
               <form labelId="search.form.label.cm_folder"   descriptionId="search.form.desc.cm_folder">cm:folder</form>
               <form labelId="type.sc_tipomodulo" descriptionId="search.form.desc.sc_tipomodulo">sc:tipomodulo</form>
         </forms>
      </advanced-search>
   </config>
   
   <config evaluator="model-type" condition="sc:tipomodulo">
      <forms>
         <!– Search form –>
         <form id="search">
            <field-visibility>
               <show id="sc:archiviata" />
               <show id="sc:codmodulo" force="true" />
               <show id="sc:codprotocollo" />
               <show id="sc:codfiscale" />
               <show id="sc:cognome" />
               <show id="sc:nome" />                                            
            </field-visibility>
            <appearance>
               <field id="sc:archiviata" label-id="prop.sc_archiviata">                     
                      <control template="/org/alfresco/components/form/controls/daterange.ftl" />
                      </field>
               <field id="sc:codmodulo" label-id="prop.sc_codmodulo">
                  <control template="/org/alfresco/components/form/controls/textfield.ftl" />
               </field>
               <field id="sc:codprotocollo" label-id="prop.sc_codprotocollo">
                      <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                      </field>
                      <field id="sc:codfiscale" label-id="prop.sc_codfiscale">
                      <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                      </field>
                      <field id="sc:cognome" label-id="prop.sc_cognome">
                      <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                      </field>
                      <field id="sc:nome" label-id="prop.sc_nome">
                      <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                      </field>
            </appearance>
         </form>
      </forms>
   </config>

</alfresco-config>  

Outcomes