Skip to content

Commit

Permalink
Merge pull request #254 from WebDevStudios/releases/2.3.0-dev
Browse files Browse the repository at this point in the history
Release: 2.3.0
  • Loading branch information
asharirfan authored Oct 31, 2022
2 parents 12cd677 + db9293d commit 95b4ba4
Show file tree
Hide file tree
Showing 452 changed files with 13,414 additions and 9,686 deletions.
14 changes: 12 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: WebDevStudios, williamsba1, gregrickaby, tw2113, richaber, mrasharirfan
Tags: Search, Algolia, Autocomplete, instant-search, relevant search, search highlight, faceted search, find-as-you-type search, suggest, search by category, ajax search, better search, custom search
Requires at least: 5.0
Tested up to: 6.0
Tested up to: 6.1
Requires PHP: 7.2
Stable tag: 2.2.0
License: GNU General Public License v2.0, MIT License
Expand Down Expand Up @@ -106,14 +106,24 @@ WebDevStudios provides end-to-end WordPress opportunities from strategy and plan

Follow along with the changelog on [Github](https://github.com/WebDevStudios/wp-search-with-algolia/releases).

= 2.3.0 =
* Add algolia_should_override_autocomplete filter to override enable/disable status of Autocomplete
* Add from_batch argument to the re-index WP-CLI command
* Update excluded custom post types and taxonomies to include Core WordPress' internal CPTs and taxonomies
* Update Algolia logos to match the latest version
* Remove jQuery usage and dependency from templates
* Update Algolia JavaScript API Client to 4.14.2
* Update Algolia InstantSearch.js to 4.49.0
* Update Algolia PHP API Client to 3.3.2

= 2.2.0 =
* Add alert to Push Settings button on the Search Page.
* Replace attributesToIndex index setting with searchableAttributes.
* Replace outdated Instant Search widget class.
* Improve drag and drop column description text on the Autocomplete page.
* Remove inline CSS for Max. Suggestions input.
* Update Algolia JavaScript API Client to 4.13.0
* Update Algolia InstantSearch.js to 4.50.5
* Update Algolia InstantSearch.js to 4.40.5
* Update Algolia Autocomplete.js to 0.38.1
* Update Algolia PHP API Client to 3.2.0

Expand Down
4 changes: 2 additions & 2 deletions algolia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP Search with Algolia
* Plugin URI: https://github.com/WebDevStudios/wp-search-with-algolia
* Description: Integrate the powerful Algolia search service with WordPress
* Version: 2.2.0
* Version: 2.3.0
* Requires at least: 5.0
* Requires PHP: 7.2
* Author: WebDevStudios
Expand All @@ -26,7 +26,7 @@
}

// The Algolia Search plugin version.
define( 'ALGOLIA_VERSION', '2.2.0' );
define( 'ALGOLIA_VERSION', '2.3.0' );

// The minmum required PHP version.
define( 'ALGOLIA_MIN_PHP_VERSION', '7.2' );
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webdevstudios/wp-search-with-algolia",
"version": "2.2.0",
"version": "2.3.0",
"description": "Integrate the powerful Algolia search service with WordPress.",
"authors": [
{
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions includes/admin/class-algolia-admin-page-autocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public function __construct( Algolia_Settings $settings, Algolia_Autocomplete_Co
*/
public function add_page() {
add_menu_page(
'Algolia Search',
esc_html__( 'Algolia Search', 'wp-search-with-algolia' ),
esc_html__( 'Algolia Search', 'wp-search-with-algolia' ),
'manage_options',
'algolia',
array( $this, 'display_page' ),
''
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MDAgNTAwLjM0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6IzAwM2RmZjt9PC9zdHlsZT48L2RlZnM+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMjUwLDBDMTEzLjM4LDAsMiwxMTAuMTYsLjAzLDI0Ni4zMmMtMiwxMzguMjksMTEwLjE5LDI1Mi44N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changes: 0 additions & 18 deletions includes/admin/css/algolia-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@
cursor: pointer;
}

/* Override admin menu styles for the algolia icon */
@font-face {
font-family: 'algolia';
src: url('../fonts/algolia.eot?nqrd9q');
src: url('../fonts/algolia.eot?nqrd9q#iefix') format('embedded-opentype'),
url('../fonts/algolia.ttf?nqrd9q') format('truetype'),
url('../fonts/algolia.woff?nqrd9q') format('woff'),
url('../fonts/algolia.svg?nqrd9q#algolia') format('svg');
font-weight: normal;
font-style: normal;
}

#adminmenu #toplevel_page_algolia .menu-icon-generic div.wp-menu-image:before,
#adminmenu #toplevel_page_algolia-account-settings .menu-icon-generic div.wp-menu-image:before {
font-family: algolia !important;
content: "\e900";
}

/* Logs page */
.log-details {
background-color: #32373c;
Expand Down
30 changes: 21 additions & 9 deletions includes/class-algolia-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function __construct() {
* [--all]
* : Re-indexes all the enabled indices.
*
* [--from_batch=<from_batch>]
* : Re-index starting from the provided batch (instead of the first page).
*
* ## EXAMPLES
*
* wp algolia re-index
Expand All @@ -68,9 +71,10 @@ public function reindex( $args, $assoc_args ) {
WP_CLI::error( 'The configuration for this website does not allow to contact the Algolia API.' );
}

$index_id = isset( $args[0] ) ? $args[0] : null;
$clear = WP_CLI\Utils\get_flag_value( $assoc_args, 'clear' );
$all = WP_CLI\Utils\get_flag_value( $assoc_args, 'all' );
$index_id = isset( $args[0] ) ? $args[0] : null;
$clear = WP_CLI\Utils\get_flag_value( $assoc_args, 'clear' );
$all = WP_CLI\Utils\get_flag_value( $assoc_args, 'all' );
$from_batch = intval( WP_CLI\Utils\get_flag_value( $assoc_args, 'from_batch', 1 ) );

if ( ! $index_id && ! $all ) {
WP_CLI::error( 'You need to either provide an index name or specify the --all argument to re-index all enabled indices.' );
Expand All @@ -95,7 +99,7 @@ public function reindex( $args, $assoc_args ) {
}

foreach ( $indices as $index ) {
$this->do_reindex( $index, $clear );
$this->do_reindex( $index, $clear, $from_batch );
}
}

Expand All @@ -107,10 +111,11 @@ public function reindex( $args, $assoc_args ) {
*
* @param Algolia_Index $index Algolia_Index instance.
* @param bool $clear Clear all existing records prior to pushing the records.
* @param int $from_batch The batch to start indexing from.
*
* @return void
*/
private function do_reindex( Algolia_Index $index, $clear ) {
private function do_reindex( Algolia_Index $index, $clear, $from_batch ) {

if ( $clear ) {
/* translators: the placeholder will contain the name of the index. */
Expand All @@ -120,7 +125,12 @@ private function do_reindex( Algolia_Index $index, $clear ) {
WP_CLI::success( sprintf( __( 'Correctly cleared index "%s".', 'wp-search-with-algolia' ), $index->get_name() ) );
}

$total_pages = $index->get_re_index_max_num_pages();
$total_pages = $index->get_re_index_max_num_pages() - ( $from_batch - 1 );

if ( 0 > $total_pages ) {
WP_CLI::error( 'from_batch value for re-indexing is out of bounds.' );
return;
}

if ( 0 === $total_pages ) {
$index->re_index( 1 );
Expand All @@ -129,16 +139,18 @@ private function do_reindex( Algolia_Index $index, $clear ) {
return;
}

$progress = WP_CLI\Utils\make_progress_bar( sprintf( 'Processing %s pages of results.', $total_pages ), $total_pages );
$progress = WP_CLI\Utils\make_progress_bar( sprintf( 'Processing %s batches of results.', $total_pages ), $total_pages );

$page = 1;
$page = $from_batch;
do {
WP_CLI::log( sprintf( 'Indexing batch %s.', $page ) );
$index->re_index( $page++ );
WP_CLI::log( sprintf( 'Indexed batch %s.', ( $page - 1 ) ) );
$progress->tick();
} while ( $page <= $total_pages );

$progress->finish();

WP_CLI::success( sprintf( 'Indexed "%s" pages of results inside index "%s"', $total_pages, $index->get_name() ) );
WP_CLI::success( sprintf( 'Indexed "%s" batches of results inside index "%s"', $total_pages, $index->get_name() ) );
}
}
3 changes: 0 additions & 3 deletions includes/class-algolia-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function register_scripts() {
'algolia-search',
ALGOLIA_PLUGIN_URL . 'js/algoliasearch/dist/algoliasearch-lite.umd.js',
[
'jquery',
'underscore',
'wp-util',
],
Expand All @@ -57,7 +56,6 @@ public function register_scripts() {
'algolia-autocomplete',
ALGOLIA_PLUGIN_URL . 'js/autocomplete.js/dist/autocomplete' . $suffix . '.js',
[
'jquery',
'underscore',
'wp-util',
'algolia-search',
Expand All @@ -80,7 +78,6 @@ public function register_scripts() {
'algolia-instantsearch',
ALGOLIA_PLUGIN_URL . 'js/instantsearch.js/dist/instantsearch' . $ais_suffix . $suffix . '.js',
[
'jquery',
'underscore',
'wp-util',
'algolia-search',
Expand Down
26 changes: 21 additions & 5 deletions includes/class-algolia-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,15 @@ public function get_excluded_post_types() {

// Native WordPress.
$excluded[] = 'revision';

// Native to Algolia Search plugin.
$excluded[] = 'algolia_task';
$excluded[] = 'algolia_log';
$excluded[] = 'custom_css';
$excluded[] = 'customize_changeset';
$excluded[] = 'oembed_cache';
$excluded[] = 'user_request';
$excluded[] = 'wp_block';
$excluded[] = 'wp_global_styles';
$excluded[] = 'wp_navigation';
$excluded[] = 'wp_template';
$excluded[] = 'wp_template_part';

// Native to WordPress VIP platform.
$excluded[] = 'kr_request_token';
Expand Down Expand Up @@ -228,6 +233,8 @@ public function get_excluded_taxonomies() {
'nav_menu',
'link_category',
'post_format',
'wp_theme',
'wp_template_part_area',
];

/**
Expand Down Expand Up @@ -259,7 +266,16 @@ public function get_excluded_taxonomies() {
* @return string Can be 'yes' or 'no'.
*/
public function get_autocomplete_enabled() {
return get_option( 'algolia_autocomplete_enabled', 'no' );
$enabled = get_option( 'algolia_autocomplete_enabled', 'no' );

/**
* Filters the autocomplete enabled option for algolia search.
*
* @since 2.3.0
*
* @param string $enabled Can be 'yes' or 'no'.
*/
return apply_filters( 'algolia_should_override_autocomplete', $enabled );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/class-algolia-template-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function load_algolia_config() {
'query' => get_search_query(),
'autocomplete' => array(
'sources' => $autocomplete_config->get_config(),
'input_selector' => (string) apply_filters( 'algolia_autocomplete_input_selector', "input[name='s']:not('.no-autocomplete')" ),
'input_selector' => (string) apply_filters( 'algolia_autocomplete_input_selector', "input[name='s']:not(.no-autocomplete):not(#adminbar-search)" ),
),
'indices' => array(),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class Algolia
{
const VERSION = '3.2.0';
const VERSION = '3.3.2';

/**
* Holds an instance of the simple cache repository (PSR-16).
Expand Down
Loading

0 comments on commit 95b4ba4

Please sign in to comment.