SearchWP implements Registerable, Standard_Service

Handles integration with SearchWP

Tags
author

Barn2 Plugins [email protected]

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
Standard_Service

Table of Contents

$applicable  : mixed
$args  : mixed
get_search_candidate_ids()  : array<string|int, mixed>|null
Complete ordered post matches for DataViews.
handle_posts_query()  : mixed
Determine if we should run the query through SearchWP
handle_ptp_args()  : array<string|int, mixed>
Store the args so we can pass them to the SearchWP query.
handle_searchwp_args()  : array<string|int, mixed>
Run our query through SearchWP.
register()  : mixed
{@inheritdoc}
use_data_cache()  : bool
SearchWP index changes must be visible on the next request.
run_candidate_search()  : array<string|int, int>
Get all SearchWP matches, leaving final eligibility and pagination to WordPress/DVE.
is_applicable()  : bool
Whether the integration applies to this search.
scope_query_args()  : Closure
Attach a marker Mod so temporary arguments affect only this SWP_Query.

Properties

$applicable

private mixed $applicable = false
Tags

Methods

get_search_candidate_ids()

Complete ordered post matches for DataViews.

public get_search_candidate_ids(array<string|int, mixed>|null $ids, string $term, object $query) : array<string|int, mixed>|null
Parameters
$ids : array<string|int, mixed>|null

Existing candidates.

$term : string

Effective search term.

$query : object

Table query.

Tags
throws
RuntimeException

When SearchWP cannot execute the search.

Return values
array<string|int, mixed>|null —

handle_posts_query()

Determine if we should run the query through SearchWP

public handle_posts_query(Table_Query $query) : mixed
Parameters
$query : Table_Query
Tags
Return values
mixed —

handle_ptp_args()

Store the args so we can pass them to the SearchWP query.

public handle_ptp_args(array<string|int, mixed> $query_args, Table_Query $query) : array<string|int, mixed>
Parameters
$query_args : array<string|int, mixed>
$query : Table_Query
Tags
Return values
array<string|int, mixed> —

handle_searchwp_args()

Run our query through SearchWP.

public handle_searchwp_args(array<string|int, mixed> $args, WP_Query $query) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>
$query : WP_Query
Tags
Return values
array<string|int, mixed> —

register()

{@inheritdoc}

public register() : mixed
Tags
Return values
mixed —

use_data_cache()

SearchWP index changes must be visible on the next request.

public use_data_cache(bool $enabled, object $cache) : bool
Parameters
$enabled : bool

Existing cache flag.

$cache : object

View cache.

Tags
Return values
bool —

Get all SearchWP matches, leaving final eligibility and pagination to WordPress/DVE.

protected run_candidate_search(array<string|int, mixed> $args) : array<string|int, int>
Parameters
$args : array<string|int, mixed>

Customized SearchWP arguments.

Tags
throws
RuntimeException

When SearchWP cannot execute the search.

Return values
array<string|int, int> —

Ordered candidate IDs.

is_applicable()

Whether the integration applies to this search.

private is_applicable(string $term, object $query) : bool
Parameters
$term : string

Effective search term.

$query : object

Table query.

Tags
Return values
bool —

scope_query_args()

Attach a marker Mod so temporary arguments affect only this SWP_Query.

private scope_query_args(array<string|int, mixed> &$args, int $per_page, int $offset) : Closure
Parameters
$args : array<string|int, mixed>

SearchWP arguments, updated with an identity marker.

$per_page : int

Effective page size.

$offset : int

Effective row offset.

Tags
Return values
Closure —

Removable query-args callback.

Search results