Skip to main content

Query Search

net.democritus:querysearch-expanders::3.9.0

To build a more advanced search operation, you can define a QuerySearch.

For what a QuerySearch is and how it compares to findersFinderA search specification combining field-operator pairs to execute standard data queries on a DataElement., see Search.

QuerySearch element​

The QuerySearch element is linked to a DataElement. This means that it is possible to create more than one QuerySearch implementation for a single DataElement.

Like DataElement, XML model files for QuerySearch elements are stored in a folder under the Component's model folder, with the name querySearchs. Similarly, the name of the QuerySearch will also be the name of the file.

Example

Let's say we wish to create a QuerySearch with name CarAvailabilitySearch, for the element Car in component carRental, the file will be as follows:

Path: <sourceBase>/components/carRental/model/querySearchs/CarAvailabilitySearch.xml

<querySearch name="CarAvailabilitySearch">
</querySearch>

This will generate files such as the QuerySearch class as <dataElement.packageName>.query.CarAvailabilitySearchQuerySearch and the QueryFilter as <dataElement.packageName>.query.CarAvailabilitySearchQueryFilter.

QueryFilterField element​

If your search operation uses input fieldsFieldA property of a DataElement expanded to a database column and user interface input element., they can be explicitly modeled by using a QueryFilterField. A QueryFilterField is not linked to a fieldFieldA property of a DataElement expanded to a database column and user interface input element. of the data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept., but simply a placeholder for the search logic.

For each QueryFilterField a type has to be defined. The fieldFieldA property of a DataElement expanded to a database column and user interface input element. types can be defined either in an expander bundleExpander BundleA set of expanders sharing a repository, packaged into an expansion resource or archive.'s data resources or directly under the component model in the queryFilterFieldTypes folder as its own file.

FieldsFieldA property of a DataElement expanded to a database column and user interface input element. are defined in the XML model file of the QuerySearch instance itself.

Example

In the following example two fieldsFieldA property of a DataElement expanded to a database column and user interface input element. are added to the QuerySearch instance. The QueryFilterField carSeats could then be used to compare with a car.numberOfSeats FieldFieldA property of a DataElement expanded to a database column and user interface input element..

<querySearch name="CarAvailabilitySearch">
<fields>
<field name="status">
<type name="String">
</field>
<field name="carSeats">
<type name="int">
</field>
</fields>
</querySearch>