Advanced Woo Search - Version 1.11

Version Description

  • Fix issue with indexing large amount of products
  • Fix bag with search page query
Download this release

Release Info

Developer Mihail Barinov
Plugin Icon 128x128 Advanced Woo Search
Version 1.11
Comparing to
See all releases

Code changes from version 1.10 to 1.11

advanced-woo-search.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
- Version: 1.10
7
  Author: ILLID
8
  Text Domain: aws
9
  */
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
  }
15
 
16
- define( 'AWS_VERSION', '1.10' );
17
 
18
 
19
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.11
7
  Author: ILLID
8
  Text Domain: aws
9
  */
13
  exit;
14
  }
15
 
16
+ define( 'AWS_VERSION', '1.11' );
17
 
18
 
19
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/css/admin.css CHANGED
@@ -70,7 +70,17 @@
70
  margin-top: 4px;
71
  }
72
 
73
- #aws-reindex.loading .loader {
 
 
 
 
 
 
 
 
 
 
74
  display: inline-block;
75
  }
76
 
70
  margin-top: 4px;
71
  }
72
 
73
+ #aws-reindex .reindex-progress {
74
+ display: none;
75
+ margin-left: 15px;
76
+ position: relative;
77
+ top: -5px;
78
+ font-size: 13px;
79
+ font-weight: bold;
80
+ }
81
+
82
+ #aws-reindex.loading .loader,
83
+ #aws-reindex.loading .reindex-progress {
84
  display: inline-block;
85
  }
86
 
assets/js/admin.js CHANGED
@@ -1,16 +1,31 @@
1
  jQuery(document).ready(function ($) {
2
  'use strict';
3
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  // Reindex table
6
- $('#aws-reindex .button').on( 'click', function(e) {
7
 
8
  e.preventDefault();
9
 
10
- var $reindexBlock = $(this).closest('#aws-reindex');
11
-
12
  $reindexBlock.addClass('loading');
13
 
 
 
 
 
 
 
 
14
  $.ajax({
15
  type: 'POST',
16
  url: aws_vars.ajaxurl,
@@ -18,16 +33,61 @@ jQuery(document).ready(function ($) {
18
  action: 'aws-reindex'
19
  },
20
  dataType: "json",
21
- success: function (data) {
22
- console.log('Reindex complete!');
23
- $reindexBlock.removeClass('loading');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
  });
26
 
27
- });
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  // Clear cache
30
- $('#aws-clear-cache .button').on( 'click', function(e) {
31
 
32
  e.preventDefault();
33
 
1
  jQuery(document).ready(function ($) {
2
  'use strict';
3
 
4
+ var $reindexBlock = $('#aws-reindex');
5
+ var $reindexBtn = $('#aws-reindex .button');
6
+ var $reindexProgress = $('#aws-reindex .reindex-progress');
7
+ var syncStatus = 'sync';
8
+ var processed = 0;
9
+ var toProcess = 0;
10
+ var processed = 0;
11
+
12
+ var $clearCacheBtn = $('#aws-clear-cache .button');
13
+
14
 
15
  // Reindex table
16
+ $reindexBtn.on( 'click', function(e) {
17
 
18
  e.preventDefault();
19
 
 
 
20
  $reindexBlock.addClass('loading');
21
 
22
+ sync();
23
+
24
+ });
25
+
26
+
27
+ function sync() {
28
+
29
  $.ajax({
30
  type: 'POST',
31
  url: aws_vars.ajaxurl,
33
  action: 'aws-reindex'
34
  },
35
  dataType: "json",
36
+ success: function (response) {
37
+ if ( 'sync' !== syncStatus ) {
38
+ return;
39
+ }
40
+
41
+ toProcess = response.data.found_posts;
42
+ processed = response.data.offset;
43
+
44
+ processed = Math.floor( processed / toProcess * 100 );
45
+
46
+ if ( 0 === response.data.found_posts && ! response.data.start ) {
47
+
48
+ // Sync finished
49
+ syncStatus = 'finished';
50
+
51
+ console.log( "Reindex finished!" );
52
+
53
+ $reindexBlock.removeClass('loading');
54
+
55
+ } else {
56
+
57
+ console.log( response.data );
58
+
59
+ $reindexProgress.html ( processed + '%' );
60
+
61
+ // We are starting a sync
62
+ syncStatus = 'sync';
63
+
64
+ sync();
65
+ }
66
+
67
+ },
68
+ error : function( jqXHR, textStatus ) {
69
+ console.log( "Request failed: " + textStatus );
70
+ cancelSync();
71
+ },
72
+ complete: function () {
73
  }
74
  });
75
 
76
+ }
77
+
78
+ function cancelSync() {
79
+ $.ajax( {
80
+ method: 'post',
81
+ url: ajaxurl,
82
+ data: {
83
+ action: 'aws-cancel-index'
84
+ }
85
+ } );
86
+ }
87
+
88
 
89
  // Clear cache
90
+ $clearCacheBtn.on( 'click', function(e) {
91
 
92
  e.preventDefault();
93
 
includes/class-aws-admin.php CHANGED
@@ -235,7 +235,7 @@ class AWS_Admin {
235
  <select name="<?php echo $value['id'].'[]'; ?>" multiple class="chosen-select">
236
  <?php $values = $plugin_options[ $value['id'] ]; ?>
237
  <?php foreach ( $value['choices'] as $val => $label ) { ?>
238
- <?php $selected = in_array( $val, $values ) ? ' selected="selected" ' : ''; ?>
239
  <option value="<?php echo $val; ?>"<?php echo $selected; ?>><?php echo $label; ?></option>
240
  <?php } ?>
241
  </select>
@@ -348,7 +348,7 @@ class AWS_Admin {
348
 
349
  echo '<th>' . __( 'Reindex table', 'aws' ) . '</th>';
350
  echo '<td>';
351
- echo '<div id="aws-reindex"><input class="button" type="button" value="' . __( 'Reindex table', 'aws' ) . '"><span class="loader"></span></div><br><br>';
352
  echo '<span class="description">' .
353
  __( 'Update all data in plugins index table. Index table - table with products data where plugin is searching all typed terms.<br>Use this button if you think that plugin not shows last actual data in its search results.<br><strong>CAUTION:</strong> this can take large amount of time.', 'aws' ) . '<br><br>' .
354
  __( 'Products in index:', 'aws' ) . '<strong> ' . AWS_Helpers::get_indexed_products_count() . '</strong>';
235
  <select name="<?php echo $value['id'].'[]'; ?>" multiple class="chosen-select">
236
  <?php $values = $plugin_options[ $value['id'] ]; ?>
237
  <?php foreach ( $value['choices'] as $val => $label ) { ?>
238
+ <?php $selected = ( is_array( $values ) && in_array( $val, $values ) ) ? ' selected="selected" ' : ''; ?>
239
  <option value="<?php echo $val; ?>"<?php echo $selected; ?>><?php echo $label; ?></option>
240
  <?php } ?>
241
  </select>
348
 
349
  echo '<th>' . __( 'Reindex table', 'aws' ) . '</th>';
350
  echo '<td>';
351
+ echo '<div id="aws-reindex"><input class="button" type="button" value="' . __( 'Reindex table', 'aws' ) . '"><span class="loader"></span><span class="reindex-progress">0%</span></div><br><br>';
352
  echo '<span class="description">' .
353
  __( 'Update all data in plugins index table. Index table - table with products data where plugin is searching all typed terms.<br>Use this button if you think that plugin not shows last actual data in its search results.<br><strong>CAUTION:</strong> this can take large amount of time.', 'aws' ) . '<br><br>' .
354
  __( 'Products in index:', 'aws' ) . '<strong> ' . AWS_Helpers::get_indexed_products_count() . '</strong>';
includes/class-aws-search-page.php CHANGED
@@ -66,6 +66,24 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
66
 
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * Filter query string used for get_posts(). Query for posts and save for later.
71
  * Return a query that will return nothing.
@@ -75,8 +93,7 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
75
  * @return string
76
  */
77
  public function filter_posts_request( $request, $query ) {
78
-
79
- if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) || ! isset( $query->query_vars['s'] ) ) {
80
  return $request;
81
  }
82
 
@@ -160,7 +177,7 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
160
  * @return array
161
  */
162
  public function filter_the_posts( $posts, &$query ) {
163
- if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) || ! isset( $query->query_vars['s'] ) || ! isset( $this->posts_by_query[spl_object_hash( $query )] ) ) {
164
  return $posts;
165
  }
166
 
@@ -176,7 +193,7 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
176
  * @param $query
177
  */
178
  public function action_pre_get_posts( $query ) {
179
- if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) || ! isset( $query->query_vars['s'] ) ) {
180
  return;
181
  }
182
 
@@ -205,7 +222,7 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
205
  * @return string
206
  */
207
  public function filter_found_posts_query( $sql, $query ) {
208
- if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) || ! isset( $query->query_vars['s'] ) ) {
209
  return $sql;
210
  }
211
 
66
 
67
  }
68
 
69
+ /**
70
+ * Check if we should override default search query
71
+ *
72
+ * @param string $query
73
+ * @return bool
74
+ */
75
+ private function aws_searchpage_enabled( $query ) {
76
+ $enabled = true;
77
+ $s = $query->get( 's' );
78
+
79
+ if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) || ! isset( $query->query_vars['s'] ) || empty( $s ) ) {
80
+ $enabled = false;
81
+ }
82
+
83
+ return apply_filters( 'aws_searchpage_enabled', $enabled, $query );
84
+
85
+ }
86
+
87
  /**
88
  * Filter query string used for get_posts(). Query for posts and save for later.
89
  * Return a query that will return nothing.
93
  * @return string
94
  */
95
  public function filter_posts_request( $request, $query ) {
96
+ if ( ! $this->aws_searchpage_enabled( $query ) ) {
 
97
  return $request;
98
  }
99
 
177
  * @return array
178
  */
179
  public function filter_the_posts( $posts, &$query ) {
180
+ if ( ! $this->aws_searchpage_enabled( $query ) || ! isset( $this->posts_by_query[spl_object_hash( $query )] ) ) {
181
  return $posts;
182
  }
183
 
193
  * @param $query
194
  */
195
  public function action_pre_get_posts( $query ) {
196
+ if ( ! $this->aws_searchpage_enabled( $query ) ) {
197
  return;
198
  }
199
 
222
  * @return string
223
  */
224
  public function filter_found_posts_query( $sql, $query ) {
225
+ if ( ! $this->aws_searchpage_enabled( $query ) ) {
226
  return $sql;
227
  }
228
 
includes/class-aws-search.php CHANGED
@@ -412,28 +412,34 @@ if ( ! class_exists( 'AWS_Search' ) ) :
412
 
413
  preg_match( '/([^.?!]*?)(' . $exact_words . '){1}(.*?[.!?])/i', $content, $matches );
414
 
415
- if ( ! $matches[0] ) {
416
  preg_match( '/([^.?!]*?)(' . $words . '){1}(.*?[.!?])/i', $content, $matches );
417
  }
418
 
419
- if ( ! $matches[0] ) {
420
  preg_match( '/([^.?!]*?)(.*?)(.*?[.!?])/i', $content, $matches );
421
  }
422
 
423
- $content = $matches[0];
424
 
 
425
 
426
- // Trim to long content
427
- if ( str_word_count( strip_tags( $content ) ) > 34 ) {
 
 
 
 
 
 
428
 
429
- if ( str_word_count( strip_tags( $matches[3] ) ) > 34 ) {
430
- $matches[3] = wp_trim_words( $matches[3], 30, '...' );
431
  }
432
 
433
- $content = '...' . $matches[2] . $matches[3];
434
 
435
- }
436
 
 
437
 
438
  $title_has_exact = preg_match( '/(' . $exact_words . '){1}/i', $title );
439
  $content_has_exact = preg_match( '/(' . $exact_words . '){1}/i', $content );
412
 
413
  preg_match( '/([^.?!]*?)(' . $exact_words . '){1}(.*?[.!?])/i', $content, $matches );
414
 
415
+ if ( ! isset( $matches[0] ) ) {
416
  preg_match( '/([^.?!]*?)(' . $words . '){1}(.*?[.!?])/i', $content, $matches );
417
  }
418
 
419
+ if ( ! isset( $matches[0] ) ) {
420
  preg_match( '/([^.?!]*?)(.*?)(.*?[.!?])/i', $content, $matches );
421
  }
422
 
423
+ if ( isset( $matches[0] ) ) {
424
 
425
+ $content = $matches[0];
426
 
427
+ // Trim to long content
428
+ if (str_word_count(strip_tags($content)) > 34) {
429
+
430
+ if (str_word_count(strip_tags($matches[3])) > 34) {
431
+ $matches[3] = wp_trim_words($matches[3], 30, '...');
432
+ }
433
+
434
+ $content = '...' . $matches[2] . $matches[3];
435
 
 
 
436
  }
437
 
438
+ } else {
439
 
440
+ $content = '';
441
 
442
+ }
443
 
444
  $title_has_exact = preg_match( '/(' . $exact_words . '){1}/i', $title );
445
  $content_has_exact = preg_match( '/(' . $exact_words . '){1}/i', $content );
includes/class-aws-table.php CHANGED
@@ -25,8 +25,6 @@ if ( ! class_exists( 'AWS_Table' ) ) :
25
 
26
  $this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
27
 
28
- //add_action( 'wp_loaded', array( $this, 'check_table' ) );
29
-
30
  add_action( 'save_post', array( $this, 'update_table' ), 10, 3 );
31
 
32
  add_action( 'aws_settings_saved', array( $this, 'clear_cache' ) );
@@ -37,10 +35,10 @@ if ( ! class_exists( 'AWS_Table' ) ) :
37
  add_action( 'edit_term', array( &$this, 'term_changed' ), 10, 3 );
38
 
39
  add_action( 'wp_ajax_aws-reindex', array( $this, 'reindex_table' ) );
40
- add_action( 'wp_ajax_nopriv_aws-reindex', array( $this, 'reindex_table' ) );
 
41
 
42
  add_action( 'wp_ajax_aws-clear-cache', array( &$this, 'clear_cache' ) );
43
- add_action( 'wp_ajax_nopriv_aws-clear-cache', array( &$this, 'clear_cache' ) );
44
 
45
  }
46
 
@@ -51,26 +49,113 @@ if ( ! class_exists( 'AWS_Table' ) ) :
51
 
52
  global $wpdb;
53
 
54
- $wpdb->query("DROP TABLE IF EXISTS {$this->table_name}");
 
55
 
56
- $this->check_table();
 
 
 
 
 
 
57
 
58
- $this->clear_cache();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  }
61
 
62
  /*
63
- * Generate table for search terms
64
  */
65
- public function check_table() {
66
 
67
  global $wpdb;
68
 
69
- if ( $wpdb->get_var( "SHOW TABLES LIKE '{$this->table_name}'" ) != $this->table_name ) {
 
 
70
 
71
- $charset_collate = $wpdb->get_charset_collate();
 
 
 
72
 
73
- $sql = "CREATE TABLE {$this->table_name} (
 
 
 
 
74
  id MEDIUMINT(20) NOT NULL DEFAULT 0,
75
  term VARCHAR(50) NOT NULL DEFAULT 0,
76
  term_source VARCHAR(20) NOT NULL DEFAULT 0,
@@ -78,38 +163,26 @@ if ( ! class_exists( 'AWS_Table' ) ) :
78
  count MEDIUMINT(20) NOT NULL DEFAULT 0
79
  ) $charset_collate;";
80
 
81
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
82
- dbDelta( $sql );
83
-
84
- $this->fill_table();
85
-
86
- }
87
 
88
  }
89
 
90
  /*
91
  * Insert data into the index table
92
  */
93
- private function fill_table( $post_id = 0 ) {
94
 
95
  global $wpdb;
96
 
97
- $posts = get_posts( array(
98
- 'posts_per_page' => -1,
99
- 'post_type' => 'product',
100
- 'no_found_rows' => 1,
101
- 'include' => $post_id
102
- ) );
103
-
104
-
105
- foreach ( $posts as $post ) {
106
 
107
  $values = array();
108
 
109
  $terms = array();
110
- $id = $post->ID;
111
 
112
- $custom = get_post_custom($id);
113
 
114
  if ( isset( $custom['_visibility'] ) && $custom['_visibility'][0] == 'hidden' ) {
115
  continue;
@@ -191,7 +264,9 @@ if ( ! class_exists( 'AWS_Table' ) ) :
191
 
192
  global $wpdb;
193
 
194
- $this->check_table();
 
 
195
 
196
  $slug = 'product';
197
 
@@ -201,7 +276,15 @@ if ( ! class_exists( 'AWS_Table' ) ) :
201
 
202
  $wpdb->delete( $this->table_name, array( 'id' => $post_id ) );
203
 
204
- $this->fill_table( $post_id );
 
 
 
 
 
 
 
 
205
 
206
  $this->clear_cache();
207
 
@@ -218,6 +301,16 @@ if ( ! class_exists( 'AWS_Table' ) ) :
218
 
219
  }
220
 
 
 
 
 
 
 
 
 
 
 
221
  /*
222
  * Clear search cache
223
  */
25
 
26
  $this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
27
 
 
 
28
  add_action( 'save_post', array( $this, 'update_table' ), 10, 3 );
29
 
30
  add_action( 'aws_settings_saved', array( $this, 'clear_cache' ) );
35
  add_action( 'edit_term', array( &$this, 'term_changed' ), 10, 3 );
36
 
37
  add_action( 'wp_ajax_aws-reindex', array( $this, 'reindex_table' ) );
38
+
39
+ add_action( 'wp_ajax_aws-cancel-index', array( $this, 'cancel_reindex' ) );
40
 
41
  add_action( 'wp_ajax_aws-clear-cache', array( &$this, 'clear_cache' ) );
 
42
 
43
  }
44
 
49
 
50
  global $wpdb;
51
 
52
+ $index_meta = get_option( 'aws_index_meta', false );
53
+ $status = false;
54
 
55
+ // No current index going on. Let's start over
56
+ if ( false === $index_meta ) {
57
+ $status = 'start';
58
+ $index_meta = array(
59
+ 'offset' => 0,
60
+ 'start' => true,
61
+ );
62
 
63
+ $wpdb->query("DROP TABLE IF EXISTS {$this->table_name}");
64
+
65
+ $this->create_table();
66
+
67
+ } else if ( ! empty( $index_meta['site_stack'] ) && $index_meta['offset'] >= $index_meta['found_posts'] ) {
68
+ $status = 'start';
69
+
70
+ $index_meta['start'] = true;
71
+ $index_meta['offset'] = 0;
72
+ $index_meta['current_site'] = array_shift( $index_meta['site_stack'] );
73
+ } else {
74
+ $index_meta['start'] = false;
75
+ }
76
+
77
+ $index_meta = apply_filters( 'aws_index_meta', $index_meta );
78
+ $posts_per_page = apply_filters( 'aws_index_posts_per_page', 100 );
79
+
80
+
81
+ $args = array(
82
+ 'posts_per_page' => $posts_per_page,
83
+ 'fields' => 'ids',
84
+ 'post_type' => 'product',
85
+ 'offset' => $index_meta['offset'],
86
+ 'ignore_sticky_posts' => true,
87
+ 'orderby' => 'ID',
88
+ 'order' => 'DESC',
89
+ );
90
+
91
+ $query = new WP_Query( $args );
92
+
93
+ $index_meta['found_posts'] = $query->found_posts;
94
+
95
+ if ( $status !== 'start' ) {
96
+
97
+ if ( $query->have_posts() ) {
98
+ $queued_posts = array();
99
+
100
+ while ( $query->have_posts() ) {
101
+ $query->the_post();
102
+
103
+ $queued_posts[] = absint( get_the_ID() );
104
+
105
+ }
106
+
107
+
108
+ $this->fill_table( $queued_posts );
109
+
110
+ $index_meta['offset'] = absint( $index_meta['offset'] + $posts_per_page );
111
+
112
+ if ( $index_meta['offset'] >= $index_meta['found_posts'] ) {
113
+ $index_meta['offset'] = $index_meta['found_posts'];
114
+ }
115
+
116
+ update_option( 'aws_index_meta', $index_meta );
117
+
118
+ } else {
119
+ // We are done (with this site)
120
+
121
+ $index_meta['offset'] = (int) $query->found_posts;
122
+
123
+ delete_option( 'aws_index_meta' );
124
+
125
+ $this->clear_cache();
126
+ }
127
+
128
+ } else {
129
+
130
+ update_option( 'aws_index_meta', $index_meta );
131
+
132
+ }
133
+
134
+ wp_send_json_success( $index_meta );
135
 
136
  }
137
 
138
  /*
139
+ * Check if index table exist
140
  */
141
+ private function is_table_not_exist() {
142
 
143
  global $wpdb;
144
 
145
+ return ( $wpdb->get_var( "SHOW TABLES LIKE '{$this->table_name}'" ) != $this->table_name );
146
+
147
+ }
148
 
149
+ /*
150
+ * Create index table
151
+ */
152
+ private function create_table() {
153
 
154
+ global $wpdb;
155
+
156
+ $charset_collate = $wpdb->get_charset_collate();
157
+
158
+ $sql = "CREATE TABLE {$this->table_name} (
159
  id MEDIUMINT(20) NOT NULL DEFAULT 0,
160
  term VARCHAR(50) NOT NULL DEFAULT 0,
161
  term_source VARCHAR(20) NOT NULL DEFAULT 0,
163
  count MEDIUMINT(20) NOT NULL DEFAULT 0
164
  ) $charset_collate;";
165
 
166
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
167
+ dbDelta( $sql );
 
 
 
 
168
 
169
  }
170
 
171
  /*
172
  * Insert data into the index table
173
  */
174
+ private function fill_table( $posts ) {
175
 
176
  global $wpdb;
177
 
178
+ foreach ( $posts as $found_post_id ) {
 
 
 
 
 
 
 
 
179
 
180
  $values = array();
181
 
182
  $terms = array();
183
+ $id = $found_post_id;
184
 
185
+ $custom = get_post_custom( $id );
186
 
187
  if ( isset( $custom['_visibility'] ) && $custom['_visibility'][0] == 'hidden' ) {
188
  continue;
264
 
265
  global $wpdb;
266
 
267
+ if ( $this->is_table_not_exist() ) {
268
+ $this->create_table();
269
+ }
270
 
271
  $slug = 'product';
272
 
276
 
277
  $wpdb->delete( $this->table_name, array( 'id' => $post_id ) );
278
 
279
+ $posts = get_posts( array(
280
+ 'posts_per_page' => -1,
281
+ 'fields' => 'ids',
282
+ 'post_type' => 'product',
283
+ 'no_found_rows' => 1,
284
+ 'include' => $post_id
285
+ ) );
286
+
287
+ $this->fill_table( $posts );
288
 
289
  $this->clear_cache();
290
 
301
 
302
  }
303
 
304
+ /*
305
+ * Cancel index
306
+ */
307
+ public function cancel_reindex() {
308
+
309
+ delete_option( 'aws_index_meta' );
310
+
311
+ wp_send_json_success( 'Deleted!' );
312
+ }
313
+
314
  /*
315
  * Clear search cache
316
  */
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Mihail Barinov
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GSE37FC4Y7CEY
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
- Tested up to: 4.7.1
7
- Stable tag: 1.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -64,6 +64,10 @@ Or insert this function inside php file ( often it used to insert form inside pa
64
 
65
  == Changelog ==
66
 
 
 
 
 
67
  = 1.10 =
68
  * Update search results page
69
  * Fix some layout issues
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GSE37FC4Y7CEY
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
+ Tested up to: 4.7.2
7
+ Stable tag: 1.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
64
 
65
  == Changelog ==
66
 
67
+ = 1.11 =
68
+ * Fix issue with indexing large amount of products
69
+ * Fix bag with search page query
70
+
71
  = 1.10 =
72
  * Update search results page
73
  * Fix some layout issues