Plugin Directory

Changeset 2728752


Ignore:
Timestamp:
05/23/2022 05:28:34 PM (4 years ago)
Author:
jsmoriss
Message:

v1.13.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wpsso-wc-metadata/tags/1.13.1/lib/search.php

    r2653897 r2728752  
    6060        public function filter_posts_search( $search, $wp_query ) {
    6161
     62            if ( $this->p->debug->enabled ) {
     63
     64                $this->p->debug->mark();
     65            }
     66
    6267            if ( ! $wp_query->is_main_query() ) {
    6368
     
    7176            $product_ids = $this->get_search_product_ids( $wp_query->saved_search_s[ 's' ] );   // Returns an array.
    7277
     78            if ( $this->p->debug->enabled ) {
     79
     80                $this->p->debug->log_arr( 'product_ids', $product_ids );
     81            }
     82
    7383            if ( empty( $product_ids ) ) {
    7484
     
    8797
    8898                $search = $matches[ 1 ] . '(' . $matches[ 2 ] .') ' . $post_id_query . $matches[ 3 ];
     99            }
     100
     101            if ( $this->p->debug->enabled ) {
     102
     103                $this->p->debug->log( 'search string = ' . $search );
    89104            }
    90105
     
    97112        private function get_search_product_ids( $s ) {
    98113
     114            if ( $this->p->debug->enabled ) {
     115
     116                $this->p->debug->mark();
     117            }
     118
    99119            $product_ids = array();
    100120
     
    124144        private function get_search_post_ids( $s ) {
    125145
     146            if ( $this->p->debug->enabled ) {
     147
     148                $this->p->debug->mark();
     149            }
     150
    126151            global $wpdb;
    127152
     
    165190            $db_query .= ');';
    166191
     192            if ( $this->p->debug->enabled ) {
     193
     194                $this->p->debug->log( 'db query = ' . $db_query );
     195            }
     196
    167197            $post_ids = $wpdb->get_col( $db_query );
    168198
     
    171201
    172202        private function get_sql_meta_keys() {
     203
     204            if ( $this->p->debug->enabled ) {
     205
     206                $this->p->debug->mark();
     207            }
    173208
    174209            $md_config = WpssoWcmdConfig::get_md_config();
     
    187222            }
    188223
     224            if ( $this->p->debug->enabled ) {
     225
     226                $this->p->debug->log_arr( 'sql_meta_keys', $sql_meta_keys );
     227            }
     228
    189229            return $sql_meta_keys;
    190230        }
     
    192232        private function get_parsed_search_terms( $terms ) {
    193233
    194             $checked = array();
     234            if ( $this->p->debug->enabled ) {
     235
     236                $this->p->debug->mark();
     237            }
     238
     239            $search_terms = array();
    195240
    196241            foreach ( $terms as $term ) {
     
    216261                }
    217262
    218                 $checked[] = $term;
    219             }
    220 
    221             return $checked;
     263                $search_terms[] = $term;
     264            }
     265
     266            if ( $this->p->debug->enabled ) {
     267
     268                $this->p->debug->log_arr( 'search_terms', $search_terms );
     269            }
     270
     271            return $search_terms;
    222272        }
    223273    }
Note: See TracChangeset for help on using the changeset viewer.