class ShowOpenSearchSuggestionsController implements RequestHandlerInterface
Discussions a browser suggests as someone types in its search box, in the OpenSearch suggestions format: the query, then titles, descriptions and addresses. Only discussions the visitor can see are suggested.
Titles are matched on the start of their words, so a word is completed as it is typed. The forum's search matches whole words on MySQL, MariaDB and PostgreSQL, so it can't suggest anything until a word is finished. A word starts after anything that isn't a letter or digit, as in "[Solved]" or "carbon-fibre", which LIKE can't express. The database finds words at the start of a title or after a space; when they are too few, it finds titles that contain the words, and where the words start is checked here.
Constants
| MIN_LENGTH |
|
| LIMIT |
|
| MAX_WORDS |
Words of the query that are matched; the rest are ignored, so a long query can't build an unbounded number of conditions. |
| CANDIDATES |
Recently active titles containing the words that are checked for words starting after punctuation, when too few start after a space. Older matches after punctuation are missed when this many titles only contain the words inside other words. |
Methods
Whether every word starts a word of the title, ignoring case and accents as MySQL, MariaDB and PostgreSQL do when finding the titles.
The word as typed and, when it has letters beyond ASCII, as it would be written in lower, upper and title case: SQLite's LIKE ignores the case of ASCII letters only.
Details
at
line 59
__construct( SlugManager $slugs, UrlGenerator $url)
at
line 65
ResponseInterface
handle( ServerRequestInterface $request)
at
line 113
protected Builder
matching( User $actor, array $words, array $patterns)
Visible discussions whose title has every word in one of the patterns, most recently active first.
at
line 136
protected bool
startsWords(string $title, array $words)
Whether every word starts a word of the title, ignoring case and accents as MySQL, MariaDB and PostgreSQL do when finding the titles.
at
line 149
protected string
withoutAccents(string $text)
at
line 161
protected array
cases(string $word)
The word as typed and, when it has letters beyond ASCII, as it would be written in lower, upper and title case: SQLite's LIKE ignores the case of ASCII letters only.