SearchController final readonly class
Minn\Rest\SearchController · public/minn/src/Minn/Rest/SearchController.php · 171 lines
wp/v2 search over published content: id, title, url, type, and the post type as subtype. Ordered the way the reference orders a search: a title holding every term first, then a title holding any term, then an excerpt match, then a content match, newest first within a rank.
Constants and properties
| private | MAX_PER_PAGE = 100 | |
| private | IDS = array ( 'exclude' => array ( 'description' => 'Ensure result set excludes specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), 'include' => array ( 'description' => 'Limit result set to specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), ) | Read by list(): the ids the results keep to, and those they leave out. |
| private | LAST_OFFSET = 1.8446744073709552E+19 | The largest row offset the database takes; a page past it fails the query, and the reference then refuses the page. |
| private | readonly Minn\Db $db | Promoted from the constructor. |
| private | readonly Minn\Rest\Types $types | Promoted from the constructor. |
| private | readonly Minn\Front\Permalinks $permalinks | Promoted from the constructor. |
| private | readonly Minn\Rest\RestUrl $url | Promoted from the constructor. |
| private | readonly Minn\Rest\Caller $caller | Promoted from the constructor. |
Public
Internals 6
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | item(Minn\Content\PostRecord $row): array# | |
| private | subtypes(mixed $subtype): array# | The post types searched: every searchable one for "any", otherwise those asked for that are post types (a taxonomy's name is another handler's subtype and finds no post here), and posts when none is left, as the reference's query falls back. A subtype is refused only when no search handler offers it, with the schema's own words: the post types', the taxonomies' and "any". @return list<string> |
| private | taxonomies(): array# | The taxonomies the term search offers as subtypes: those shown in REST that are public. @return list<string> @return list<string> |
| private | rankExpression(array $terms, array $params): string# | A CASE that ranks a title match over an excerpt over a content match. |
| private | terms(string $search): array# | @return list<string> |
| private | escapeLike(string $value): string# |
Nothing matches.