2

I am trying to modify share-config-custom.xml so that I can search emails by the following properties:

           <!-- cm:emailed aspect -->
           <show id="cm:originator" />
           <show id="cm:addressee" />
           <show id="cm:addressees" />
           <show id="cm:sentdate" />
           <show id="cm:subjectline" />

This is my share-config-custom.xml:

    <config evaluator="model-type" condition="cm:content">
    <forms> 
        <form label="Mails">
            <field-visibility>
               <show id="cm:originator" />
               <show id="cm:addressee" />
               <show id="cm:addressees" />
               <show id="cm:sentdate" />
               <show id="cm:subjectline" />
            </field-visibility>
        </form>
    </forms>
   </config>

  <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="Mails" descriptionId="Search for Mails">cm:content</form>
     </forms>
  </advanced-search>

And it doesn't work. I have tried aspect, node-type instead of model-type. I used many combination of force="true", for-mode="view" ... still couldn't get it work. In the search form I can't see anything related to the properties. It's just a default search form. Any help will be appreciated.

up: To be clear, the problem is that I have some documents with cm:emailed aspect. I want to create a form for only searching such documents. However, when I say "<form labelId="Mails" descriptionId="Search for Mails">cm:content</form> " the default content search form also modified. I believe that there must be some easy way or ways. I don't want to define a new type in my custom model, I leave this solution for the last.

newzad
  • 706
  • 1
  • 14
  • 29

1 Answers1

5

The share config isn't correct. Take a look at https://wiki.alfresco.com/wiki/Share_Advanced_Search#Search_Forms

You need to change the model-type of cm:content form id="search" with the aspect fields.

I'm on the phone so the answer maybe short.

--UPDATE-- You can't select an Aspect in the drop-down in the Advanced Search, the current implementation of Alfresco doesn't allow that.

You what I do in most cases, I just add the aspect fields to the default cm:content type.

Or when I have more control on when the aspect is applied, I just create a new type custom:mailed and have the parent cm:content and as mandatory aspect cm:emailed. Then you could create a behaviour which specialized the type to custom:mailed or create an inbound rule in Alfresco which fires on hasAspect cm:emailed.

I hope this clears a bit.

Tahir Malik
  • 6,623
  • 15
  • 22
  • You can't select aspects in the search config, so yes the only way to see aspects is to add them to the default cm:content – Tahir Malik Jun 09 '15 at 08:41
  • Like I said and will do that again: No it's not possible to select an aspect. So No there is no easy way. The easiest way is to create a type like I suggested. The hard way is to define you own custom advanced search config and override the default and do whatever you want with it. – Tahir Malik Jun 09 '15 at 12:31