cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Search don't work

fedemori
Champ in-the-making
Champ in-the-making
Hi,
I create a new Custom Model. The upload works correctly bat the advanced search don't go.
This is my code:

customModel.xml

<type name="custom:fatturaVendita">
         <title>Fattura di Vendita</title>
         <description/>
         <parent>cm:content</parent>
         <properties>
            <property name="custom:nDocVendita">
               <title>N. Documento</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <index enabled="true">
                  <atomic>true</atomic>
                  <tokenised>false</tokenised>
               </index>
            </property>
            <property name="custom:dataDocVendita">
               <title>Data Documento</title>
               <type>d:date</type>
               <mandatory>true</mandatory>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>both</tokenised>
               </index>
            </property>
            <property name="custom:ordineVendita">
               <title>Ordine di Vendita</title>
               <type>d:text</type>
               <default/>
               <index enabled="true">
                  <atomic>true</atomic>
                  <tokenised>false</tokenised>
               </index>
            </property>
            <property name="custom:intrastatVendita">
               <title>Intrastat</title>
               <type>d:boolean</type>
               <default>false</default>
            </property>
            <property name="custom:ragoSocVendita">
               <title>Ragione Sociale</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <index enabled="true">
                  <atomic>true</atomic>
                  <tokenised>false</tokenised>
               </index>
            </property>
            <property name="custom:contabilizzaVendita">
               <title>Stato</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <default>DA CONTABILIZZARE</default>
               <index enabled="true">
                  <atomic>true</atomic>
                  <tokenised>false</tokenised>
               </index>
               <constraints>
                  <constraint ref="custom:contabilizza"/>
               </constraints>
            </property>
         </properties>
      </type>


web-client-config-custom.xml

<config evaluator="node-type" condition="custom:fatturaVendita">
      <property-sheet>
         <show-property name="mimetype" display-label-id="content_type" component-generator="MimeTypeSelectorGenerator"/>
         <show-property name="size" display-label-id="size" converter="org.alfresco.faces.ByteSizeConverter" show-in-edit-mode="false"/>
         <show-property name="custom:nDocVendita"/>
         <show-property name="custom:dataDocVendita"/>
         <show-property name="custom:ordineVendita"/>
         <show-property name="custom:intrastatVendita"/>
         <show-property name="custom:ragoSocVendita"/>
         <show-property name="custom:contabilizzaVendita"/>
      </property-sheet>
   </config>


<config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <type name="custom:fatturaVendita"/>
      </content-types>
   </config>
   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
         <content-types>
            <type name="custom:fatturaVendita"/>
         </content-types>
         <custom-properties>
            <!–custom:fatturaVendita–>
            <meta-data type="custom:fatturaVendita" property="custom:nDocVendita"/>
            <meta-data type="custom:fatturaVendita" property="custom:dataDocVendita"/>
            <meta-data type="custom:fatturaVendita" property="custom:ordineVendita"/>
            <meta-data type="custom:fatturaVendita" property="custom:intrastatVendita"/>
            <meta-data type="custom:fatturaVendita" property="custom:ragoSocVendita"/>
            <meta-data type="custom:fatturaVendita" property="custom:contabilizzaVendita"/>
         </custom-properties>
      </advanced-search>
   </config>

share-config-custom.xml

<config evaluator="string-compare" condition="DocumentLibrary" replace="true">
      <tree>
         <!–
            Whether the folder Tree component should enumerate child folders or not.
            This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
         –>
         <evaluate-child-folders>false</evaluate-child-folders>
         <!–
            Optionally limit the number of folders shown in treeview throughout Share.
         –>
         <maximum-folder-count>-1</maximum-folder-count>
      </tree>
      <types>
         <type name="cm:content">
            <subtype name="custom:fatturaVendita"/>
         </type>
      </types>
</config>
<config evaluator="node-type" condition="custom:fatturaVendita">
      <forms>
         <form>
            <field-visibility>
               <show id="cm:name"/>
               <show id="cm:title" force="true"/>
               <show id="cm:description" force="true"/>
               <show id="cm:taggable" for-mode="edit" force="true"/>
               <show id="custom:nDocVendita"/>
               <show id="custom:dataDocVendita"/>
               <show id="custom:ordineVendita"/>
               <show id="custom:intrastatVendita"/>
               <show id="custom:ragoSocVendita"/>
               <show id="custom:contabilizzaVendita"/>
            </field-visibility>
            <appearance>
               <field id="cm:taggable">
                  <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>
            </appearance>
         </form>
      </forms>
   </config>
<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
      <advanced-search>
         <!– Forms for the advanced search type list –>
         <forms>
            <!–
               The 'form' config element contains the name of the model type
               of the form to display.
              
               The element supports the following optional attributes:
                  id = form id, the id of "search" will be assumed if not set
                  label = label text to display - defaults to model type if not set
                  labelId = I18N message id of label text to display
                  description = description text to display
                  descriptionId = I18N message id of description text to display
            –>
            <form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
            <form label="Fatture di Vendita" description="Fatture di Vendita">custom:fatturaVendita</form>
         </forms>
      </advanced-search>
   </config>
   <config evaluator="model-type" condition="cm:content">
      <forms>
         <form id="search">
            <field-visibility>
               <show id="cm:name"/>
               <show id="cm:title" force="true"/>
               <show id="cm:description" force="true"/>
               <show id="shc:type" force="true"/>
               <show id="shc:owner" force="true"/>
               <show id="shc:dateAdopted" force="true"/>
               <show id="shc:reviewDate" force="true"/>
            </field-visibility>
         </form>
      </forms>
   </config>
   <config evaluator="model-type" condition="custom:fatturaVendita">
      <forms>
         <!– Search form –>
         <form id="search">
            <field-visibility>
               <show id="cm:name"/>
               <show id="custom:nDocVendita"/>
               <show id="custom:dataDocVendita"/>
               <show id="custom:ordineVendita"/>
               <show id="custom:intrastatVendita"/>
               <show id="custom:ragoSocVendita"/>
               <show id="custom:contabilizzaVendita" force="true"/>
            </field-visibility>
            <appearance>
               <field id="custom:dataDocVendita">
                  <control template="/org/alfresco/components/form/controls/daterange.ftl"/>
               </field>
            </appearance>
         </form>
      </forms>
   </config>

What is the problem?
3 REPLIES 3

abarisone
Star Contributor
Star Contributor
Hi,
in my experience I had the same issue.
Your configurations seem correct, but when using Share's Advanced Search I was only able to find nodes only by content search or the exact property value.
With Alfresco Explorer, instead, I was able to find everything.
Surely I don't know if it is a Share limitation or some kind of bug.

Regards,
Andrea

hdalang
Champ in-the-making
Champ in-the-making
I'm trying to do the same thing, first just to make it simple for you, I will talk about share-config.xml
$tomcat\webapps\share\WEB-INF\classes\alfresco

you will see :

<config evaluator="string-compare" condition="AdvancedSearch">
      <advanced-search>
         <!– Forms for the advanced search type list –>
         <forms>
            <!–
               The 'form' config element contains the name of the model type
               of the form to display.
              
               The element supports the following optional attributes:
                  id = form id, the id of "search" will be assumed if not set
                  label = label text to display - defaults to model type if not set
                  labelId = I18N message id of label text to display
                  description = description text to display
                  descriptionId = I18N message id of description text to display
            –>
            <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>

####here add your new form
         <form labelId="type.sc_whitepaper" descriptionId="type.form.desc.sc_whitepaper">sc:whitepaper</form>
         </forms>
      </advanced-search>
   </config>


once you restart the server you will see the new choice in advanced search.

Regards,,

—————————————————-
###Please if you saw my post is useful " mark comment as useful".

billerby
Champ on-the-rise
Champ on-the-rise
I ran into this as well and noticed that Alfresco is not escaping the search terms correct when the tokenisation of a property are set to "true" or "false". When using "both" it works. This is a bug in the query construction made when using advanced search in Share.

Example:

When including an index enabled property with tokenisation set to true or false like this:

<property name="my:documentStatusType">
<type>d:text</type>
<mandatory>true</mandatory>
<default>workingDocument</default>
<index enabled="true">
<atomic>false</atomic>
<stored>false</stored>
<tokenised>false</tokenised>
</index>
</property>


In the resulting query the above property gets escaped like this:

((TYPE:"my:doc" AND (my:documentStatusType:\"workingDocument\")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden" limit=502


This query returns a result when the tokenisation is set to "both", but with it set to "true" or "false" no results are returned.

However, removing the backslash escaping from the above query makes the query return my result (when using "true" or "false").

According to Alfresco this bug will (probably) be adressed and corrected in version 4.2.2.

(https://issues.alfresco.com/jira/browse/MNT-11180)