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

NameTypeRequiredDescription
qstringYesThe search term for which to build a filter
objectNamestringYesName of the object to filter against
gridFieldsarrayYesArray of "grid fields" to be searched against
labelfieldstringNo
searchFieldsarrayNoOptional array of fields that will be used to search against
expandTermsbooleanNo (default=false)If true, the search term (`q`) will be split into individual words