class PostSearcher extends AbstractSearcher

Methods

__construct(FilterManager $filters, array $mutators)

No description

search(SearchCriteria $criteria)

No description

getTotalResults(Builder $query)

No description

void
applySort(DatabaseSearchState $state, array|null $sort = null, bool $sortIsDefault = false)

No description

void
applyTieBreaker(DatabaseSearchState $state)

Order rows the requested sort leaves tied.

static string
lastOrderDirection(array|null $orders)

The direction of the last ordering in a list, or ascending if it has none.

void
applyOffset(DatabaseSearchState $state, int $offset)

No description

void
applyLimit(DatabaseSearchState $state, int|null $limit)

No description

Builder
getQuery(User $actor)

No description

Details

__construct(FilterManager $filters, array $mutators)

Parameters

FilterManager $filters
array $mutators

Parameters

SearchCriteria $criteria

Return Value

SearchResults

protected Closure getTotalResults(Builder $query)

Parameters

Builder $query

Return Value

Closure

protected void applySort(DatabaseSearchState $state, array|null $sort = null, bool $sortIsDefault = false)

Parameters

DatabaseSearchState $state
array|null $sort
bool $sortIsDefault

Return Value

void

protected void applyTieBreaker(DatabaseSearchState $state)

Order rows the requested sort leaves tied.

Sorting by a column that isn't unique leaves the order of tied rows to the database, which is free to differ between engines, versions and even executions. Results are then paginated by offset, so an unstable order can repeat a row on one page and skip it on the next. Ending every sort on the primary key makes the order total.

Parameters

DatabaseSearchState $state

Return Value

void

static protected string lastOrderDirection(array|null $orders)

The direction of the last ordering in a list, or ascending if it has none.

The tie breaker follows it rather than always ascending: an InnoDB secondary index already carries the primary key, so `column DESC, id DESC` is still answered by an index on `column` alone, where mixing the two directions forces a filesort.

Parameters

array|null $orders

Return Value

string

protected void applyOffset(DatabaseSearchState $state, int $offset)

Parameters

DatabaseSearchState $state
int $offset

Return Value

void

protected void applyLimit(DatabaseSearchState $state, int|null $limit)

Parameters

DatabaseSearchState $state
int|null $limit

Return Value

void

Builder getQuery(User $actor)

Parameters

User $actor

Return Value

Builder