buildSearchFilter()
Overview
public any function buildSearchFilter(
required string q
, required string objectName
, required array gridFields
, string labelfield
, array searchFields
, boolean expandTerms = false
)
Builds a filter expression matching the search term against the appropriate grid/search fields. The default behaviour is to return a simple filter string; the "q" filterParam for the search term is expected to be provided separately.
As of 10.13.0*, a new argument is added - expandTerms
. If true, then the search term will be broken down into individual words and the search will attempt to match ALL the words, even if they are found in different fields. In this scenario, the method will return a struct containing filter
and filterParams
.
Arguments
Name | Type | Required | Description |
---|---|---|---|
q | string | Yes | The search term for which to build a filter |
objectName | string | Yes | Name of the object to filter against |
gridFields | array | Yes | Array of "grid fields" to be searched against |
labelfield | string | No | |
searchFields | array | No | Optional array of fields that will be used to search against |
expandTerms | boolean | No (default=false) | If true, the search term (`q`) will be split into individual words |