The Alfresco Share 3.4.a release includes a new Advanced Search page with a fully customisable user interface.
Based on customer and partner requests the Advanced Search interface is based on Forms. This allows a search page to be built and customised for any content, folder or custom type in the system. It also allows custom Form controls to be used within the interface. frame|c|none|Advanced Search - Default Content Search Form The Forms are defined using the same style of configuration as data input and data output forms found in many places in Alfresco Share, including Document and Folder Details pages and the new Workflow interface.
The following describes example configurations and what is required to achieve common customizations.
Adding a new Form to the Advanced Search interface is a two stage process. Firstly you need to override the configuration that defines the list of available forms and the labels used to represent them in the interface. This is the default configuration from share-config.xml:
Override this section to add a new form. Add an element <form> with appropriate label and description attributes for the type this Form is describing. If the label and description attributes are not set, the name of the type in the Data Dictionary will be used. Each form in the system has an identifier and the identifier of 'search' will be assumed if not set in the configuration above.
You will need to define a search form for each type you wish to be displayed in the user interface. The Search Forms section below details how to construct search Form definitions.
When the Advanced Search user interface is displayed, it reads this configuration and adds each form to the Look for menu. frame|c|none|Advanced Search - Look For menu The resolved label attribute is displayed as the visible name of the form in the menu, and the description is used as the tooltip for the menu item.
The fields defined in that Form are then displayed if the user selects it from the menu. The order of the elements in the configuration above defines the order of the forms in the menu and the first form element in the list will be shown by default when the user enters the Advanced Search page.
To add a search Form for a type, or to override the default Forms already provided for cm:content and cm:folder, a Form definition should be configured. For detailed information on Forms and Form definitions see the Forms guide page.
Search forms are added to the Form config for a type and given the identifier of 'search' (a different identifier can be used if set in the configuration detailed above). See share-form-config.xml for default search forms for cm:content and cm:folder types. A Form definition can be added or overridden (eg. cm:folder type:
Note the element <form id='search'>. This is the definition of the 'search' Form for the cm:folder type. The <field-visibility> section defines which properties of the type to display controls for and the <appearance> element specifies additional information to the Forms engine such as which template to use to render the control.
Search Form Example
To add a new custom SOP type as described in the Data Dictionary Guide. First override the advanced-search configuration in share-config-custom.xml and add the following form element:
Reading the Forms Guide mentioned above will help understand how to add the appropriate Form control for common Data Dictionary types, but here are some examples of controls and configuration suggestions for Advanced Search usage.
There are some caveats to defining forms for use in Advanced Search. Forms are generally designed to be used for data input or read-only data output. For example, during data input some common fields for types are made read-only by the system as they are not appropriate for the user to modify - such as 'Modified Date'. However they do make sense to search against, therefore some changes might be needed from the obvious configuration for a property to allow fields to appear correctly and make sense for a search form.
A property that has a list-of-values constraint defined against it.
Normally the Forms engine would render this using a drop-down that forces the user to always select a value - for a search it may be more appropriate to make the field optional in the form: