cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 5.1: Advanced search with custom type not working if type is applied using javaScript API.

vurquia
Champ in-the-making
Champ in-the-making

Hello All,

I am using alfresco 5.1.

I created a custom types that extends of cm:content like:

  <types>

       <type name="hip:hipDocType">

            <title>My Document</title>

            <parent>cm:content</parent>

            <mandatory-aspects>

            <aspect>hip:docMetaData</aspect>

            </mandatory-aspects>

       </type>

  </types>

And create and advanced Search definition like:

<config evaluator="string-compare" condition="AdvancedSearch">

  <advanced-search>

  <forms>

  <!-- Custom type -->

       <form labelId="MyDocument" descriptionId="My Document">hip:hipDocType</form>

  </forms>

  </advanced-search>

</config>

When I change the type of documents using a javascript function "doc.Spezialice()" the document appear in a normal search, and in any query executed directly on alfresco but never appear in the advanced search Smiley Sad

BUT when I  change some field manually I can get it.

In the past I solve this using only lucene indexation but now I thing that only can be used solr. Any help?

Best

Vladimir.

5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator

Can you provide the form configuration for your advanced search? I have seen issues where the form configuration included some fields that implicitly restricted the search results and confused the user/customer similar to what you described...

vurquia
Champ in-the-making
Champ in-the-making

Many thanks Axel Faust

My configuration is:

  <config evaluator="string-compare" condition="AdvancedSearch" replace="true">

       <advanced-search>

       <!-- advanced search Content type list -->

       <content-types>          

            <type name="propertyMetaSmiley TongueropertyDocType" />          

             (...)

       </content-types>

  <custom-properties>

       <meta-data aspect="hip:docMetaData" property="docHip:HipDocID" />

       <meta-data aspect="hip:docMetaData" property="docHipSmiley TongueortfolioName" />

       <meta-data aspect="hip:docMetaData" property="docHip:NDG" />

       <meta-data aspect="hip:docMetaData" property="docHip:docType" />

       <meta-data aspect="hip:docMetaData" property="docHipSmiley SurprisedfficeCountry" />

       <meta-data aspect="hip:docMetaData" property="docHip:docDate" />

  </custom-properties>

  <!-- Forms for the advanced search type list -->

  <forms>

  <!-- Custom types -->

  <form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form>

  <form labelId="type.search.form.property.doc" descriptionId="Search for Properties Documents">propertyMetaSmiley TongueropertyDocType</form>

          (...)

  </forms>

  </advanced-search>

  </config>

And forms definitions like:

<!-- Fields to appear in the advanced search when the type propertyMetaSmiley TongueropertyDocType is selected -->

  <config evaluator="model-type" condition="propertyMetaSmiley TongueropertyDocType">

  <forms>

  <form>

       <field-visibility>

               <show id="docHip:HipDocID" force="true" />

               <show id="cm:name" force="true" />

                <show id="cm:title" force="true" /> 

                <show id="cm:created" force="true" />

                <show id="docHipSmiley TongueortfolioName" force="true" />

                <show id="docHip:NDG" force="true" /> 

                <show id="docHipSmiley SurprisedfficeCountry" force="true" />

                <show id="docHip:docDate" force="true" />

           </field-visibility>

  </form>

  <form id="search">

  <field-visibility>

  <show id="docHip:HipDocID" />

  <show id="cm:name" force="true" />

  <show id="cm:title" force="true" />

  <show id="cm:created" force="true" />

  <show id='cm:taggable' force='true' />

  <show id="cm:categories" force="true" />

  <!-- Propiedades basicas -->

  <show id="docHipSmiley TongueortfolioName" />

  <show id="docHip:NDG" /> 

  <show id="docHipSmiley SurprisedfficeCountry"/>

  <show id="docHip:docDate"/>

  <!-- Propiedades Especficas-->

  <show id="propertyMetaSmiley TongueropertyPID" />

  <show id="propertyMetaSmiley TongueropertyDType" />

  </field-visibility>

  <appearance>

  <set id="properties" appearance="panel" template="/org/alfresco/components/form/2-column-set.ftl" label="Basic Document Properties"/>

  <field id="docHip:HipDocID" set="properties" label="Hipoges Doc. ID" />

  <field id="cm:name" set="properties" label="Name" />

  <field id="cm:title" set="properties" label="Title" />

  <field id="cm:created" set="properties" label="Registration Date">

  <control template="/org/alfresco/components/form/controls/daterange.ftl" />

  </field>

  <field id="cm:categories" set="properties" >

  <control>

  <control-param name="compactMode">true</control-param>

  <control-param name="showSubCategoriesOption">true</control-param>

  </control>

  </field>

  <field id="cm:taggable" set="properties" >

  <control>

  <control-param name="compactMode">true</control-param>

  <control-param name="params">aspect=cm:taggable</control-param>

  <control-param name="createNewItemUri">/api/tag/workspace/SpacesStore</control-param>

  <control-param name="createNewItemIcon">tag</control-param>

  </control>

  </field>

  <!-- Mis Propiedades-->

  <set id="mis_properties" template="/org/alfresco/components/form/2-column-set.ftl" appearance="panel" label="Properties Documents/>

    

  <field id="docHipSmiley TongueortfolioName" set="mis_properties" label="Portfolio Name" />

  <field id="docHip:NDG" set="mis_properties"  label="Borrower ID" />

  <field id="docHipSmiley SurprisedfficeCountry" set="mis_properties" label="Office Country" />

  <field id="docHip:docDate" set="mis_properties"  label="Document Date">

  <control template="/org/alfresco/components/form/controls/daterange.ftl" />

  </field>

  <field id="propertyMetaSmiley TongueropertyPID" set="mis_properties" label="Property ID" />

  <field id="propertyMetaSmiley TongueropertyDType" set="mis_properties" label="Property Document Type" />

  </appearance>

  </form>

  </forms>

  </config>

afaust
Legendary Innovator
Legendary Innovator

You have quite a few custom properties there - are some of them d:boolean (checkbox-like) properties or have a list of values constraint (drop down box)? These are the most common types of properties that can cause the advanced search to filter more than intended and leave the result empty while a simple search finds the intended documents.

vurquia
Champ in-the-making
Champ in-the-making

Yes i do not have booleans but several constraints.

Can you provide me some example/ trick to avoid the empty result?

Why can I get the nodes without any problem in the advanced search  if I update using alfresco share, even using this configuration?

redflow
Confirmed Champ
Confirmed Champ

I have the same problem. A custom type derived from cm:folder with few fields with list of values, una date field and an integer field. How should I use advanced search?

I googled for an answer without success....