Generating Queries from a Struct

If you have a Cúram struct you wish to use to generate a query you can do so using this method: setTerms(final Object key).

This expects a struct where each attribute XX has a corresponding boolean attribute called searchByXX which specified whether that attribute should be used to search. Each attribute XX will be assumed to correspond to a SearchServiceField in your SearchService.

If the names of the attributes of your struct do not correspond to the names of the Fields you have defined for your Search Service (see Field and name), then you can define a mapping between them using a dictionary HashMap. The mapping is from the attribute names in the struct to the SearchServiceField names. Simply add the pairs of strings to the HashMap, with the name of the struct attribute as the key and the name of the Field as the value. The dictionary can be specified in the constructor when you create your QueryBuilder object or later using the setDictionary(HashMap<String, String>) method.