This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: User Search and Multiple Keywords

Home Forums Product Support Forums Ajax Search Pro for WordPress Support User Search and Multiple Keywords Reply To: User Search and Multiple Keywords

#20397
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

I have managed to find a solution, but I am not sure how this will affect the performance, as it requires sub-query usage. I had to make a direct change in one of the search files.

The change I made was in file wp-content\plugins\ajax-search-pro\includes\classes\search\class-asp-search-users.php on line 207 from this:

$parts[] = "( $wpdb->usermeta.meta_key = '" . $meta_field . "' AND ( " . $pre_field . $wpdb->usermeta . ".meta_value" . $suf_field . " LIKE $pre_like'$wcl" . $word . "$wcr'$suf_like ) )";

to this:

$parts[] = "EXISTS( SELECT 1 FROM $wpdb->usermeta sums WHERE sums.user_id = $wpdb->users.ID AND sums.meta_key = '" . $meta_field . "' AND ( " . $pre_field . "sums.meta_value" . $suf_field . " LIKE $pre_like'$wcl" . $word . "$wcr'$suf_like ) )";

Please make a copy of this, as unfortunately I cannot include this in an upcoming release due to possible performance consequences.