Searches through a list of filters and finds a specific predicate that should be appended at the top level of a search (i.e., has special requirements for combining with other predicates). Also verifies that the predicate is not combined in any invalid ways.
- Only ONE filter can have a predicate with the target field
- Only ONE predicate with the target field can exist
- The predicate can only be ANDed to other predicates
- The predicate's field value MUST be a string or boolean (not string or IMatchOptions)
Example: Portal's bbox field cannot be conditionally searched. Any value provided will always be applied as a top-level filter.
- Invalid: `?filter=type:CSV OR (type:PDF AND bbox=1,2,3,4)
the field of the desired predicate
filters to be searched / validated
the predicate (if present and all requirements are met)
Function defined in common/src/search/_internal/commonHelpers/getTopLevelPredicate.ts:22