Define a hidden search request on a form to apply criteria, columns, sorting, or aggregations invisible to users.
The ComponentSearchPresenter object accepts a hiddenRequest property with a com.flower.docs.domain.search.SearchRequest class bean. This request allows you to:
- add hidden criteria
- configure the columns to be displayed
- set default sorting
- set the number of results to be displayed
- configure aggregations for tree-view display
Sorting
The default sort order of results is configured using the orderClauses property on the SearchRequest object. Each OrderClause defines a field name and a sort direction.
<property name="orderClauses">
<list>
<bean class="com.flower.docs.domain.search.OrderClause">
<property name="name" value="creationDate" />
<property name="ascending" value="false" />
</bean>
</list>
</property>Multiple sort clauses can be combined. They are applied in order of declaration.
Aggregation
An aggregation groups search results by field values, displaying them as a tree structure. When a bucket is selected, the search is filtered to match that bucket’s criteria.
Aggregations are configured using the aggregation property on the SearchRequest object with a FieldAggregation bean. Nested aggregations create multi-level grouping.
<property name="aggregation">
<bean class="com.flower.docs.domain.search.FieldAggregation">
<property name="nested">
<list>
<bean class="com.flower.docs.domain.search.FieldAggregation">
<property name="field" value="TypeCourrier" />
</bean>
<bean class="com.flower.docs.domain.search.FieldAggregation">
<property name="field" value="CanalEntree" />
</bean>
</list>
</property>
</bean>
</property>Hidden columns
To retrieve tag values via the selectClause without displaying them as visible columns, use the hiddenColumns property on the ComponentSearchPresenter. See Search results for details.
- We recommend using the notion of hidden requests to simplify access to components, rather than to secure access to them.
- Add the
ADD_FILTERS_TO_SELECTcriterion with thetruevalue in the request contexts to display the criteria filled in as columns.