Db
Database class
Namespace: WebberZone\Better_Search
Since: 4.2.0
Source: includes/class-db.php line 19
Methods
create_fulltext_indexes() static
Create fulltext indexes on the posts table.
Since: 3.3.0
Line: 42
static public function create_fulltext_indexes( );
delete_fulltext_indexes() static
Delete the FULLTEXT index.
Since: 4.2.0
Line: 59
static public function delete_fulltext_indexes( );
is_index_installed() static
Check if a fulltext index already exists on the posts table.
Since: 4.0.0
Line: 80
static public function is_index_installed( $index ): bool;
| Type | Name | Description |
|---|---|---|
string | $index | Index name. |
Returns: bool — True if the index exists, false otherwise.
install_fulltext_index() static
Install a fulltext index on the posts table.
Since: 4.0.0
Line: 116
static public function install_fulltext_index( $index, $columns ): void;
| Type | Name | Description |
|---|---|---|
string | $index | Index name. |
string | $columns | Columns to be indexed. |
Returns: void
get_fulltext_indexes() static
Get the list of fulltext indexes to be created on the posts table.
Since: 4.0.0
Line: 130
static public function get_fulltext_indexes( ): array;
Returns: array — Array of fulltext indexes with their respective columns.
get_old_fulltext_indexes() static
Get the list of old fulltext indexes.
Since: 4.2.0
Line: 154
static public function get_old_fulltext_indexes( ): array;
Returns: array — Array of fulltext indexes with their respective columns.
check_fulltext_indexes() static
Check the status of all fulltext indexes.
Since: 4.0.0
Line: 169
static public function check_fulltext_indexes( ): array;
Returns: array — Array of index statuses indicating whether they are installed.
is_fulltext_index_installed() static
Check if all fulltext indexes are installed.
Since: 4.0.0
Line: 203
static public function is_fulltext_index_installed( ): bool;
Returns: bool — True if all fulltext indexes are installed, false if any are missing.
is_table_installed() static
Check if the Better Search table is installed.
Since: 4.0.2
Line: 223
static public function is_table_installed( $table_name ): bool;
| Type | Name | Description |
|---|---|---|
string | $table_name | Table name. |
Returns: bool — True if the table exists, false otherwise.
maybe_create_table() static
Create table if not exists.
Since: 4.2.0
Line: 241
static public function maybe_create_table( $table_name, $sql );
| Type | Name | Description |
|---|---|---|
string | $table_name | Table name. |
string | $sql | SQL to create the table. |
create_tables() static
Create tables.
Since: 4.2.0
Line: 257
static public function create_tables( );
create_full_table_sql() static
Create full table sql.
Since: 4.2.0
Line: 269
static public function create_full_table_sql( ): string;
Returns: string — SQL to create the full table.
create_daily_table_sql() static
Create full daily table sql.
Since: 4.2.0
Line: 292
static public function create_daily_table_sql( ): string;
Returns: string — SQL to create the daily table.
recreate_table() static
Recreate a table.
This method recreates a table by creating a backup, dropping the original table, and then creating a new table with the original name and inserting the data from the backup.
Since: 4.2.0
Line: 326
static public function recreate_table( $table_name, $create_table_sql, $backup = ..., $fields = ..., $group_by_fields = ... ): bool|\WP_Error;
| Type | Name | Description |
|---|---|---|
string | $table_name | The name of the table to recreate. |
string | $create_table_sql | The SQL statement to create the new table. |
bool | $backup | Whether to backup the table or not. |
array | $fields | The fields to include in the temporary table and on duplicate key code. |
array | $group_by_fields | The fields to group by in the temporary table. |
Returns: bool|\WP_Error — True if recreated, error message if failed.
recreate_overall_table() static
Recreate overall table.
Since: 4.2.0
Line: 377
static public function recreate_overall_table( $backup = ... ): bool|\WP_Error;
| Type | Name | Description |
|---|---|---|
bool | $backup | Whether to backup the table or not. |
Returns: bool|\WP_Error — True if recreated, error message if failed.
recreate_daily_table() static
Recreate daily table.
Since: 4.2.0
Line: 395
static public function recreate_daily_table( $backup = ... ): bool|\WP_Error;
| Type | Name | Description |
|---|---|---|
bool | $backup | Whether to backup the table or not. |
Returns: bool|\WP_Error — True if recreated, error message if failed.