Indexer implements Standard_Service

Handles indexing of products.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Standard_Service

Table of Contents

$chunk_size  : int
Number of posts to index before updating progress.
$facet  : Filter
The individual facet (filter) being processed.
get_chunk_size()  : int|string
Get the chunk size for batch indexing.
get_post_ids_to_index()  : array<string|int, mixed>
Get an array of post IDs to index.
index()  : void
Rebuild the index for all or a given post.
index_batch()  : void
Run the indexing process of all products in batches.
index_post()  : void
Index an individual post.
index_row()  : void
Pre-process the indexed data before insertion.
insert()  : string
Insert the indexed data into the database table.
is_batch_index_running()  : bool
Determine if batch indexing is currently running.
is_silently_running()  : bool
Determine if the indexing is silently running.
safe_value()  : string
Hash a facet value if needed
set_index_running()  : void
Set a flag in the database to mark the index as running
get_row_data()  : array<string|int, mixed>
Find the data for the specified facet.
truncate_index()  : void
Truncate the index table.

Properties

$chunk_size

Number of posts to index before updating progress.

public int $chunk_size = 30

$facet

The individual facet (filter) being processed.

public Filter $facet

Methods

get_chunk_size()

Get the chunk size for batch indexing.

public get_chunk_size() : int|string
Return values
int|string

get_post_ids_to_index()

Get an array of post IDs to index.

public get_post_ids_to_index([bool|string|int $post_id = false ][, bool|int|string $offset = false ][, bool|int|string $limit = false ]) : array<string|int, mixed>
Parameters
$post_id : bool|string|int = false
$offset : bool|int|string = false
$limit : bool|int|string = false
Return values
array<string|int, mixed>

index()

Rebuild the index for all or a given post.

public index([bool|string|int $post_id = false ]) : void
Parameters
$post_id : bool|string|int = false

false to re-index everything.

Return values
void

index_batch()

Run the indexing process of all products in batches.

public index_batch(int $offset, int $limit) : void
Parameters
$offset : int

WP_Query offset parameter.

$limit : int

WP_Query posts_per_page parameter.

Return values
void

index_post()

Index an individual post.

public index_post(string $post_id, Collection $filters) : void
Parameters
$post_id : string
$filters : Collection
Return values
void

index_row()

Pre-process the indexed data before insertion.

public index_row(array<string|int, mixed> $params) : void
Parameters
$params : array<string|int, mixed>

indexed data for the processed facet

Return values
void

insert()

Insert the indexed data into the database table.

public insert(array<string|int, mixed> $params) : string
Parameters
$params : array<string|int, mixed>

indexed data

Return values
string

ID number of the row belonging to the data

is_batch_index_running()

Determine if batch indexing is currently running.

public is_batch_index_running() : bool
Return values
bool

is_silently_running()

Determine if the indexing is silently running.

public is_silently_running() : bool
Return values
bool

safe_value()

Hash a facet value if needed

public safe_value(string $value) : string
Parameters
$value : string
Return values
string

set_index_running()

Set a flag in the database to mark the index as running

public set_index_running(bool $running[, bool $silently = false ]) : void
Parameters
$running : bool

whether or not the index is running.

$silently : bool = false

whether or not the indexer should be running silently (no admin notice displayed)

Return values
void

get_row_data()

Find the data for the specified facet.

private get_row_data(array<string|int, mixed> $defaults) : array<string|int, mixed>
Parameters
$defaults : array<string|int, mixed>
Return values
array<string|int, mixed>

truncate_index()

Truncate the index table.

private truncate_index() : void
Return values
void

Search results