The advanced search feature lets you specify a range of values, as in this example:
Find all recipes that take between 5 minutes and 25 minutes to cook
The advancedSearchPropertyRanges
property is a HashMap that you can set to hold maximum and minimum values. You create a range by setting a property’s max
and min
keys and their respective values. For example:
<dsp:input type="text" bean= "MyAdvSearchFH.advancedSearchPropertyRanges.recipe.cookTime.min" value="5"/> <dsp:input type="text" bean= "MyAdvSearchFH.advancedSearchPropertyRanges.recipe.cookTime.max" value="25"/>
In this example, recipe
is an item type defined for the repository that supports this search component (MyAdvancedSearchFormHandler
). The cookTime
property is a primitive string. If another primitive type were used, a tag converter would be inserted as part of the value
phrase.
Range settings are inclusive: in this example, the search result can include recipes that take 5 and 25 minutes to cook. You can leave the search range open at either end by leaving the maximum or minimum value undefined. For example:
Find all recipes that use at least 8 tomatoes
The code to implement this search might look like this:
<dsp:input type="text" bean="MyAdvSearchFH.advancedSearchPropertyRanges.recipe.tomatoes.min" value="8"/>