Advanced search

XML files are used to configure search forms. Use the internal editor to edit the file.


The editor can be accessed via the Administration > Display > XML menu :

  • Click on the + to create a new XML file,
  • In the first field, enter Client folder search to name the XML file,
  • Enter the XML code described in the rest of this tutorial,
  • Click on the Savebutton.

Identifier

The first thing to do is to give the search a dossierClientSearch unique identifier. This identifier will make it easy to retrieve this search.


This identifier will also be used to associate the search form with the team that will have access to it.


	<bean id="dossierClientSearch" class="com.flower.docs.gui.client.search.ComponentSearchPresenter" scope="prototype">	  
	</bean>


Note: These two tags correspond to the start and end tags of a search definition. As a result, everything that will be described in the rest of this example must be inserted between these two tags.


Title, description and category

From a technical point of view, the identifier enables the search to be retrieved, but is not visible to users.

In this case, the name, description and category will make it easier to use the advanced search:

  • Set the title property to its value Client folders,
  • Describe the property description with its value Search for a client folder by reference, surname or first name.


<property name="title" value="Dossiers Clients" />
<property name="description" value="Rechercher un dossier client par sa référence, son nom ou son prénom."/>


Categorize the search using the categorieSelectorPresenter property:

  • Enable a single category with the FakeCategorySelectorPresenter class,
  • Use VIRTUAL_FOLDER for client folders.


	<property name="categorySelectorPresenter">
		<bean class="com.flower.docs.gui.client.search.criteria.item.FakeCategorySelectorPresenter">
				<property name="value">
				<value type="com.flower.docs.domain.component.Category">VIRTUAL_FOLDER</value>
				</property>
		</bean>
	</property>


The keywordCriteriaPresenter keyword search will not be used. Disable this search using the enabled property and its value false:


<property name="keywordCriteriaPresenter">
	<bean class="com.flower.docs.gui.client.search.criteria.KeywordCriteriaPresenter">
		<property name="enabled" value="false" />
	</bean>
</property>


All the properties described in the rest of this page must be placed in the AdvancedCriteriaPresenter bean. Define advanced search with the AdvancedCriteriaPresenter property:


<property name="advancedCriteriaPresenter">
    <bean class="com.flower.docs.gui.client.search.criteria.advanced.AdvancedCriteriaPresenter" />
</property>


Disable the category selector displayClassSelector using its false value which allows only client folders to be searched as follows:


<property name="displayClassSelector" value="false" />


To force the opening of the advanced search, add the forceOpen property with its true value:


<property name="forceOpen" value="true" />


Set the addEmptyCriterion property to true so that the user can add criteria:


<property name="addEmptyCriterion" value="true" />


Define the showSearchButton to launch the search:


<property name="showSearchButton" value="true" />