Function that constructs the SQLFragment for the search field.
A helper function that takes a field name and returns a SQLFragment for that field, which should be used to construct the final SQLFragment for the search field.
a SQLFragment representing the search field, which must reference selected fields through the provided helper function.
For example, to construct a search field that searches by display name (nullable column) with fallback to full name, the fieldConstructor function could be implemented as follows:
fieldConstructor: (getFragmentForFieldName) => {
const displayNameFragment = getFragmentForFieldName('display_name');
const fullNameFragment = getFragmentForFieldName('full_name');
return sql`COALESCE(NULLIF(${displayNameFragment}, ''), split_part(${fullNameFragment}, '/', 2))`;
}
Specification for a search field that is a manually constructed SQLFragment. Useful for complex search fields that require transformations to make nullable fields non-null or to make combinations of multiple fields.