AnsweredAssumed Answered

Customized Advanced Search by aspects not returning results

Question asked by yuhuayang on Aug 29, 2013
Latest reply on Aug 31, 2013 by mitpatoliya
Hi

I created a custom model and several aspects (not properties). I then attached this aspect to a document and input some data for each aspect.

I followed the guides here: http://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/share-aspects-and-advanced-search-02062013 and http://customizealfresco.blogspot.com/2012/09/customize-alfresco-share-advance-search.html and I have successfully added a custom Advanced Search form to search by aspects. However, the problem is that the search returns nothing! Why is this? I can find the documents using the solr/lucene search syntax but it is really user-unfriendly and I would like my users to use the search forms rather than esoteric aspect:name:query formats.

Here is the snippet added to share-config-custom.xml file:

<config evaluator="string-compare" condition="AdvancedSearch">
      <advanced-search>
         <!– Forms for the advanced search type list –>
         <forms>
            <form label="HR Documents" description="Hr Documents">hr:docs</form>
         </forms>
      </advanced-search>
   </config>

   <config evaluator="model-type" condition="hr:docs">
      <forms>
         <!– Search form –>
         <form id="search">
            <field-visibility>
               <show id="hr:name" force="true"/>
               <show id="hr:id" force="true"/>
               <show id="hr:formType" force="true"/>
               <show id="hr:dateOfDoc" force="true"/>
            </field-visibility>
         </form>
      </forms>
   </config>


and here is the code for the model.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<model name="hr:hrModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    <description>HR Metadata</description>
    <author>yangy</author>
    <version>1.0</version>
    <imports>
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
    </imports>
    <namespaces>
        <namespace uri="http://www.mydomain.com/model/hrModel/1.0" prefix="hr"/>
    </namespaces>

    <types>
        <type name="hr:docs">
                <title>HR Documents</title>
                <parent>cm:content</parent>
        </type>
    </types>

    <aspects>
        <aspect name="hr:metadata">
            <title>HR Metadata</title>
            <properties>
                <property name="hr:name">
                    <title>Name</title>
                    <type>d:text</type>
                </property>
                <property name="hr:id">
                    <title>ID</title>
                    <type>d:text</type>
                </property>
                <property name="hr:formType">
                    <title>Form Type</title>
                    <type>d:text</type>
                </property>
                <property name="hr:dateOfDoc">
                    <title>Date of Document</title>
                    <type>d:date</type>
                </property>
             </properties>
        </aspect>
    </aspects>
</model>



any help is appreciated

Outcomes