Sets the search option for the field. The list of search options is available in the Arguments section. This code should go to AfterTableInit event of the List page.
Syntax
setSearchOption($field, $option);
Arguments
$field
the name of the field.
$option
an option to be set. Accepts one of the following as the search option:
•CONTAINS
•EQUALS
•STARTS_WITH
•MORE_THAN
•LESS_THAN
•BETWEEN
•EMPTY_SEARCH
•NOT_CONTAINS
•NOT_EQUALS
•NOT_STARTS_WITH
•NOT_MORE_THAN
•NOT_LESS_THAN
•NOT_BETWEEN
•NOT_EMPTY
Example 1
How to make sure that the BETWEEN option is always applied when we search for the Year field .
Note: this is not an UI option, it will be applied behind the scene. If you need to change the default search option that appears on the Advanced Search page or on the Search panel, proceed to Choose fields -> Search and filter settings and select the default search option for the field in question under 'Options'.
$srchObj = SearchClause::getSearchObject("Employees");
$option = $srchObj->getSearchOption("Year");
if ($option != BETWEEN) {
$srchObj->setSearchOption("Year", BETWEEN);
}