AnsweredAssumed Answered

Unable to search by custom properties?

Question asked by mgkarlo on Oct 28, 2014
Latest reply on Oct 29, 2014 by mgkarlo
Greetings,

I have been using the Alfresco Maven SDK targeting the 4.2.e release to create a custom content model and some share customizations. I was able to get by most of the process, but I was having problems when searching by properties that used the d:date or d:int data types. I was able to fix the d:int problem by changing it to a d:text type property and adding some constraints. However, I am unable to get past the problem with the d:date property.

I've checked and revised the model file and the share-config-custom file, but I can't seem to find the source of the problem. The model loads with no obvious errors and I am able to create files, fill properties. The search looks how I want it, but it always fails to return the expected results.

Here is my code so far:

glModel.xml:


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

<!– Definition of new Model –>

<model name="gl:globalModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <!– Optional meta-data about the model –>
   <description>Global Model</description>
   <author>Karlo E</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="global.model"
         prefix="gl" />
   </namespaces>

   <constraints>
      <constraint name="gl:documentTypeList" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Medida</value> <!– Medida –>
               <value>Resolucion</value> <!– Resolucion –>
               <value>Tramite</value> <!– Tramite –>
               <value>Diario</value> <!– Diario –>
               <value>Acta</value> <!– Acta –>
               <value>Ley</value> <!– Ley –>
            </list>
         </parameter>
      </constraint>
      <constraint name="gl:documentBodyList" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Camara</value>
               <value>Senado</value>
            </list>
         </parameter>
      </constraint>
      <constraint name="gl:documentYears" type="REGEX">
         <parameter name="expression">
            <value>\b(195[3-9]|19[6-9][0-9]|20[0-4][0-9]|2050)\b</value>
         </parameter>
      </constraint>
      <constraint name="gl:documentNumbers" type="REGEX">
         <parameter name="expression">
            <value>\b0*[0-9]{1,4}\b</value>
         </parameter>
      </constraint>
   </constraints>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="gl:doc">
         <title>Documento Legislativo</title>
         <parent>cm:content</parent>
         <properties>
            <property name="gl:period">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
            <property name="gl:year">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
               <constraints>
                  <constraint ref="gl:documentYears" />
               </constraints>
            </property>
            <property name="gl:docType">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
               <constraints>
                  <constraint ref="gl:documentTypeList" />
               </constraints>
            </property>
            <property name="gl:date">
               <type>d:datetime</type>
               <multiple>false</multiple>
            </property>
         </properties>
      </type>
   </types>

   <aspects>
      <aspect name="gl:extraInfo">
         <title>Extra Relationships</title>
         <properties>
            <property name="gl:link">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
            <property name="gl:tag">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
      </aspect>

      <aspect name="gl:docInfo">
         <title>Document Information</title>
         <properties>
            <property name="gl:body">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
               <constraints>
                  <constraint ref="gl:documentBodyList" />
               </constraints>
            </property>
            <property name="gl:author">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
            <property name="gl:subject">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
      </aspect>

      <aspect name="gl:diaryInfo">
         <title>Diary Information</title>
         <properties>
            <property name="gl:president">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
      </aspect>

      <aspect name="gl:billInfo">
         <title>Bill Information</title>
         <properties>
            <property name="gl:billType">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
            <property name="gl:billNumber">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
               <constraints>
                  <constraint ref="gl:documentNumbers" />
               </constraints>
            </property>
            <property name="gl:resNumber">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
               <constraints>
                  <constraint ref="gl:documentNumbers" />
               </constraints>
            </property>
            <property name="gl:lawNumber">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
               <constraints>
                  <constraint ref="gl:documentNumbers" />
               </constraints>
            </property>
            <property name="gl:conNumber">
               <type>d:text</type>
               <multiple>false</multiple>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>true</tokenised>
               </index>
               <constraints>
                  <constraint ref="gl:documentNumbers" />
               </constraints>
            </property>
         </properties>
      </aspect>
   </aspects>
</model>


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="gl:extraInfo" />
            <aspect name="gl:docInfo" />
            <aspect name="gl:diaryInfo" />
            <aspect name="gl:billInfo" />
         </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="gl:doc" />
         </type>
      </types>
   </config>
   <config evaluator="node-type" condition="gl:doc">
      <forms>
         <form>
            <field-visibility>
               <show id="cm:name" />
               <show id="gl:period" />
               <show id="gl:year" />
               <show id="gl:date" />
               <show id="gl:docType" />
            </field-visibility>
            <appearance>
               <field id="cm:name" label-id="prop.cm_name" />
               <field id="gl:period" label-id="prop.gl_period" />
               <field id="gl:year" label-id="prop.gl_year" />
               <field id="gl:date" label-id="prop.gl_date" />
               <field id="gl:docType" label-id="prop.gl_docType" />
            </appearance>
         </form>
      </forms>
   </config>
   <config evaluator="aspect" condition="gl:docInfo">
      <forms>
         <form>
            <field-visibility>
               <show id="gl:body" />
               <show id="gl:author" />
               <show id="gl:subject" />
            </field-visibility>
            <appearance>
               <field id="gl:body" label-id="prop.gl_body" />
               <field id="gl:author" label-id="prop.gl_author" />
               <field id="gl:subject" label-id="prop.gl_subject" />
            </appearance>
         </form>
      </forms>
   </config>
   <config evaluator="aspect" condition="gl:billInfo">
      <forms>
         <form>
            <field-visibility>
               <show id="gl:billType" />
               <show id="gl:billNumber" />
               <show id="gl:resNumber" />
               <show id="gl:lawNumber" />
               <show id="gl:conNumber" />
            </field-visibility>
            <appearance>
               <field id="gl:billType" label-id="prop.gl_billType" />
               <field id="gl:billNumber" label-id="prop.gl_billNumber" />
               <field id="gl:resNumber" label-id="prop.gl_resNumber" />
               <field id="gl:lawNumber" label-id="prop.gl_lawNumber" />
               <field id="gl:conNumber" label-id="prop.gl_conNumber" />
            </appearance>
         </form>
      </forms>
   </config>
   <config evaluator="aspect" condition="gl:diaryInfo">
      <forms>
         <form>
            <field-visibility>
               <show id="gl:president" />
            </field-visibility>
            <appearance>
               <field id="gl:president" label-id="prop.gl_president" />
            </appearance>
         </form>
      </forms>
   </config>
   <config evaluator="aspect" condition="gl:extraInfo">
      <forms>
         <form>
            <field-visibility>
               <show id="gl:link" />
               <show id="gl:tag" />
            </field-visibility>
            <appearance>
               <field id="gl:link" label-id="prop.gl_link" />
               <field id="gl:tag" label-id="prop.gl_tag" />
            </appearance>
         </form>
      </forms>
   </config>

   <config replace="true" evaluator="string-compare" condition="AdvancedSearch">
      <advanced-search>
         <!– Forms for the advanced search type list –>
         <forms>
            <form labelId="type.gl_doc" descriptionId="search.form.desc.gl_doc">gl:doc
            </form>
            <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>
         </forms>
      </advanced-search>
   </config>

   <!– gl:doc type (new nodes) –>
   <config evaluator="model-type" condition="gl:doc">
      <forms>
         <!– Search form –>
         <form id="search">
            <field-visibility>
               <!– cm:content fields –>
               <show id="cm:name" />
               <!– gl:doc fields –>
               <show id="gl:period" force="true" />
               <show id="gl:year" force="true" />
               <show id="gl:docType" force="true" />
               <show id="gl:date" force="true" />
               <!– gl:billInfo fields –>
               <show id="gl:billType" force="true" />
               <show id="gl:billNumber" force="true" />
               <show id="gl:resNumber" force="true" />
               <show id="gl:lawNumber" force="true" />
               <show id="gl:conNumber" force="true" />
               <!– gl:docInfo fields –>
               <show id="gl:body" force="true" />
               <show id="gl:author" force="true" />
               <show id="gl:subject" force="true" />
               <!– gl:diaryInfo –>
               <show id="gl:president" force="true" />
               <!– gl:extraInfo –>
               <show id="gl:link" force="true" />
               <show id="gl:tag" force="true" />
            </field-visibility>
            <appearance>
               <!– cm:content fields –>
               <field id="cm:name" label-id="prop.cm_name" />
               <!– gl:doc fields –>
               <field id="gl:period" label-id="prop.gl_period" />
               <field id="gl:year" label-id="prop.gl_year" />
               <field id="gl:date" label-id="prop.gl_date">
                  <control template="/org/alfresco/components/form/controls/daterange.ftl" />
               </field>
               <field id="gl:docType" label-id="prop.gl_docType" />
               <!– gl:billInfo fields –>
               <field id="gl:billType" label-id="prop.gl_billType" />
               <field id="gl:billNumber" label-id="prop.gl_billNumber" />
               <field id="gl:resNumber" label-id="prop.gl_resNumber" />
               <field id="gl:lawNumber" label-id="prop.gl_lawNumber" />
               <field id="gl:conNumber" label-id="prop.gl_conNumber" />
               <!– gl:diaryInfo fields –>
               <field id="gl:president" label-id="prop.gl_president" />
               <!– gl:docInfo fields –>
               <field id="gl:body" label-id="prop.gl_body" />
               <field id="gl:author" label-id="prop.gl_author" />
               <field id="gl:subject" label-id="prop.gl_subject" />
               <!– gl:extraInfo fields –>
               <field id="gl:link" label-id="prop.gl_link" />
               <field id="gl:tag" label-id="prop.gl_tag" />
            </appearance>
         </form>
      </forms>
   </config>
</alfresco-config>


glModel.properties:


#cm:content
prop.cm_name=Nombre de Archivo

#gl:doc
type.gl_doc=Documento Legislativo
search.form.desc.gl_doc=Busqueda Documentos Legislativos
prop.gl_period=Cuatrienio
prop.gl_year=A\u00f1o
prop.gl_docType=Tipo de Documento
prop.gl_date=Fecha

#gl:billInfo
aspect.gl_billInfo=Informacion de Medida Legislativa
prop.gl_billType=Tipo de Medida
prop.gl_billNumber=Numero de Medida
prop.gl_resNumber=Numero de Resolucion
prop.gl_lawNumber=Numero de Ley
prop.gl_conNumber=Numero de Res Conj

#gl:docInfo
aspect.gl_docInfo=Informacion de Documentos Legislativos
prop.gl_body=Cuerpo
prop.gl_author=Legislador
prop.gl_subject=Tema

#gl:diaryInfo
aspect.gl_diaryInfo=Informacion de Diario de Sesion
prop.gl_president=Presidente

#gl:extraInfo
aspect.gl_extraInfo=Informacion Adicional
prop.gl_link=Enlace
prop.gl_tag=Etiqueta

Outcomes