On version 5.4, the advanced search is configured to work in conjunction with a content view.
AdvancedSearch document type
AdvancedSearch document type is attached to this content view, and will store query parameters. Its default schema definition can be found here: advanced_search.xsd. It can be overridden to add new custom fields, or redefined completely as the document type is only referenced in the content view.
Its content view definition shows the mapping between this document properties and the query to build (see search-contentviews-contrib.xml).
Search_form and Search_results_advanced layouts
The search form and search results reference the content view name (see search_form.xhtml and search_results_advanced.xhtml) and also use the Seam component DocumentSearchActions to store the sort information and selected result columns.
The result layout used here is named
search_listing_ajax. It is configured as a standard listing layout, and holds additional information on its columns definition so that it can be used to display the search columns selection and the sort infos available columns. It is used with the following modes:
- "edit_columns" when displaying the column selection widget as shown above
- "edit_sort_infos" or "edit_sort_infos_map" when displaying the sort information list widget as shown above. These two modes are equivalent, but the new item to add to the list is a
org.nuxeo.ecm.core.api.SortInfoinstance in the first case, and a map with keys "sortColumn" and "sortAscending" in the second case.
- "view" when displaying the search results table (listing layout)
Here are screenshots of this layout rendered in these modes:
Here is an excerpt of this layout definition:
All the columns have names defined so that this value can be used as the key when computing the list of selected columns. If not set, the name will be generated according to the column position in the layout definition, but as this definition may change, it is recommended to set specific names for better maintenance and upgrade.
The columns that should not be selected by default hold the additional parameter "
selectedByDefault", and it is set to "false" as all columns (and rows) are considered selected by default. Hence the "description" and "subjects" columns are not selected by default, and shown in the left selector when displaying this layout in mode "edit_sort_infos" or "edit_sort_infos_map".
Properties defined on the layout in mode "edit_columns" are used by the layout template layout_column_selection_template.xhtml.
Properties defined on the layout and columns in mode "edit_sort_infos" or "edit_sort_infos_map" are used by the layout template layout_sort_infos_template.xhtml. This template filters presentation of columns that do not hold the property "
showInSortInfoSelection" set to "true" as some columns may not support sorting (for instance, as sorting cannot be done on the "subjects" complex property, the associated column should not be made available in the sort selection widget).
The column selection and sort information will be taken into account by the content view if:
- the template displaying results binds this information to the backing bean holding the values, for instance:
- or the content view definition holds these bindings, for instance: