cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced search with custom type not working when has more than one field on search parameter

fabiogomes_ti
Champ in-the-making
Champ in-the-making
Hi guys,

I think this is a bug on Alfresco 5.0.d community (Default instalation), i have created a custom type with some custom properties, when i put then at advanced search i have no result.

Analysing the URL passed to the search, i have noted that if i pass only one property to search, it returns results, so the advanced search was using the AND Operator to find the documents on the repo.

Someone thas has face this problem and solve it?

Sorry by my english.

My model and type


<?xml version="1.0" encoding="UTF-8"?> <model name="aut:autenticaModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Modelo de tipologia documental customizada da Autêntica</description>
   <author>Fábio Gomes [Data Gestão]</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>
   <namespaces>
      <namespace uri="ecm.autentica.com.br" prefix="aut"/>
   </namespaces>
    <types>
      <type name="aut:contrato">
         <title>Contrato</title>
         <parent>cm:content</parent>
         <properties>
            <property name="aut:tituloFinal">
               <title>Título Final</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:autor">
               <title>Autor</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:tradutor">
               <title>Tradutor</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:ilustrador">
               <title>Ilustrador</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:capista">
               <title>Capista</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:editoraInternacional">
               <title>Editora Internacional</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:agenteLiterário">
               <title>Agente Literário</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:dataAssinaturaContrato">
               <title>Data de Assinatura do Contrato</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:prazoDoContrato">
               <title>Prazo do contrato</title>
               <type>d:date</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:status">
               <title>Status</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
               <constraints>
                  <constraint type="LIST">
                     <parameter name="allowedValues">
                        <list>
                           <value>Ativo</value>
                           <value>Encerrado</value>
                        </list>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
            <property name="aut:dataRenovacaoContrato">
               <title>Data de Renovação Contrato</title>
               <type>d:date</type>
               <mandatory>false</mandatory>
            </property>
            <property name="aut:numeroContrato">
               <title>Numero do Contrato</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
         </properties>
      </type>
     
   </types>
</model>


My share-config

<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
      <advanced-search>
         <!– Forms for advanced search type list –>
         <forms>
         <form labelId="Contrato" id="gdi_searchAutentica" description="Pesquisar nos contratos da Autêntica">cm:content</form>
         <form labelId="search.form.label.cm_content" id="search" descriptionId="search.form.desc.cm_content">cm:content</form>
           <form labelId="search.form.label.cm_folder" id="search" descriptionId="search.form.desc.cm_folder">cm:folder</form>
         </forms>
      </advanced-search>
   </config>  

   <config evaluator="node-type" condition="aut:contrato">
      <forms>
         <!– Default form configuration for the cm:content type –>
         <form>
            <field-visibility>
               <!– Custom properties –>
               <show id="aut:tituloFinal" />
               <show id="aut:autor" />
               <show id="aut:tradutor" />
               <show id="aut:ilustrador" />
               <show id="aut:capista" />
               <show id="aut:editoraInternacional" />
               <show id="aut:dataAssinaturaContrato" />
            <show id="aut:prazoDoContrato" />
            <show id="aut:status" />
            <show id="aut:dataRenovacaoContrato" />
            <show id="aut:numeroContrato" />
         </field-visibility>
         </form>
         <!– Document Library pop-up Edit Metadata form –>
         <form id="doclib-simple-metadata">
            <field-visibility>
               <show id="aut:tituloFinal" />
               <show id="aut:autor" />
               <show id="aut:tradutor" />
               <show id="aut:ilustrador" />
               <show id="aut:capista" />
               <show id="aut:editoraInternacional" />
               <show id="aut:dataAssinaturaContrato" />
            <show id="aut:prazoDoContrato" />
            <show id="aut:status" />
            <show id="aut:dataRenovacaoContrato" />
            <show id="aut:numeroContrato" />
            </field-visibility>
         </form>
      </forms>
   </config>
   <!– cm:content type (creating nodes) –>
   <config evaluator="model-type" condition="aut:contrato">
      <forms>
         <!– Default Create Content form –>
         <form>
            <field-visibility>
               <show id="aut:tituloFinal" />
               <show id="aut:autor" />
               <show id="aut:tradutor" />
               <show id="aut:ilustrador" />
               <show id="aut:capista" />
               <show id="aut:editoraInternacional" />
               <show id="aut:dataAssinaturaContrato" />
            <show id="aut:prazoDoContrato" />
            <show id="aut:status" />
            <show id="aut:dataRenovacaoContrato" />
            <show id="aut:numeroContrato" />
            </field-visibility>         
         </form>
      </forms>
   </config>
   <config evaluator="model-type" condition="cm:content">
      <forms>
         <!– Search form –>
         <form id="gdi_searchAutentica">
            <field-visibility>
               <show id="aut:tituloFinal" force="true" />
           
               <show id="aut:autor" force="true" />
               <show id="aut:tradutor" force="true" />
               <show id="aut:ilustrador" force="true"  />
               <show id="aut:capista" force="true" />
               <show id="aut:editoraInternacional" force="true" />
               <show id="aut:dataAssinaturaContrato" force="true" />
            <show id="aut:prazoDoContrato" force="true" />
            <show id="aut:status" force="true" />
            <show id="aut:dataRenovacaoContrato" force="true" />
            <show id="aut:numeroContrato" force="true" />
           
            </field-visibility>           
         </form>
      </forms>
   </config>
2 REPLIES 2

douglascrp
World-Class Innovator
World-Class Innovator
Hey Fabio, how are you?

Looking at the code you have shared, I saw some small mistakes:

<form labelId="Contrato" id="gdi_searchAutentica" description="Pesquisar nos contratos da Autêntica">cm:content</form>

I think there is a mistake there, as this is a search for your custom type.
The tags' value should be aut:contrato instead of cm:content, which is your custom type.

Another thing, you should be using the id "search", the default value, and your form config should be based on your custom type, also using the form id = search.

Try the code bellow instead:

<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
   <advanced-search>
      <!– Forms for advanced search type list –>
      <forms>
         <form labelId="Contrato" id="search" description="Pesquisar nos contratos da Autêntica">aut:contrato</form>
         <form labelId="search.form.label.cm_content" id="search" descriptionId="search.form.desc.cm_content">cm:content</form>
         <form labelId="search.form.label.cm_folder" id="search" descriptionId="search.form.desc.cm_folder">cm:folder</form>
      </forms>
   </advanced-search>
</config>

and this

<config evaluator="model-type" condition="aut:contrato">
   <forms>
      <!– Search form –>
      <form id="search">
         <field-visibility>
            <show id="aut:tituloFinal" force="true" />
            <show id="aut:autor" force="true" />
            <show id="aut:tradutor" force="true" />
            <show id="aut:ilustrador" force="true"  />
            <show id="aut:capista" force="true" />
            <show id="aut:editoraInternacional" force="true" />
            <show id="aut:dataAssinaturaContrato" force="true" />
            <show id="aut:prazoDoContrato" force="true" />
            <show id="aut:status" force="true" />
            <show id="aut:dataRenovacaoContrato" force="true" />
            <show id="aut:numeroContrato" force="true" />
         </field-visibility>           
      </form>
   </forms>
</config>

Let me know if you get different results.

Hi Douglas,

I tried your suggestion but i guess same result.
In really, the id="search" is default, if i put my own id on "model-type" will work too, i did it on 4.1 alfresco version.

Appears there exists a problem with search, when i comment out all fields except one, it works.