If field has a 'attached_posts_search_query_cb', run the callback.

@since  1.2.4

@param  WP_Query $query     WP_Query instance during the pre_get_posts hook.
@param  array    $post_args The $_POST array.

@return void
199884
public function maybe_callback( $query, $post_args ) {
		$cmb   = isset( $post_args['cmb_id'] ) ? $post_args['cmb_id'] : '';
		$group = isset( $post_args['group_id'] ) ? $post_args['group_id'] : '';
		$field = isset( $post_args['field_id'] ) ? $post_args['field_id'] : '';

		$cmb = cmb2_get_metabox( $cmb );
		if ( $cmb && $group ) {
			$group = $cmb->get_field( $group );
		}

		if ( $cmb && $field ) {
			$group = $group ? $group : null;
			$field = $cmb->get_field( $field, $group );
		}

		if ( $field && ( $cb = $field->maybe_callback( 'attached_posts_search_query_cb' ) ) ) {
			call_user_func( $cb, $query, $field, $this );
		}
	}
782694
protected function paginateList(Builder $query): void
    {
        $this->setAttribute('list', $query->paginate($this->getAttribute('rowsNumber')));
        $this->getAttribute('list')->appends([
            'rowsNumber' => $this->getAttribute('rowsNumber'),
            'search'     => $this->getAttribute('search'),
            'sortBy'     => $this->getAttribute('sortBy'),
            'sortDir'    => $this->getAttribute('sortDir'),
        ]);
    }
365236
public function bindValues($query) {
        if (!empty($this->bind_values) && !empty($this->bind_keys)) {
            if (!$query instanceof \PDOStatement) {
                $this->setError('q', 'No valid PDO Statement provided');
            }

            for ($ii = 0; $ii < count($this->bind_values); $ii++) {
                $param = $this->get_PDO_param($this->bind_values[$ii]);
                $value = $this->bind_values[$ii];
                $key = $this->bind_keys[$ii];

                $query->bindValue($key, $value, $param);
            }
        }
    }
927646
public function genUnionBindValues (&$query, $args)
	{
		
		foreach ($args as $key => $arg)
		{

			if (isset ($arg['where']) && is_array ($arg['where']))
			{
				$this->genBindValues ($query, $arg['where']);
			}
			
			if (isset ($arg['having']) && is_array ($arg['having']))
			{
				$this->genBindValues ($query, $arg['having']);
			}

		}
	}
612525
public function query($query, $params = []) {
		
		if(false === is_string($query)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($query)), E_USER_ERROR);
		}

		if(null !== $params && false === is_array($params)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($params)), E_USER_ERROR);
		}

		if(null === $this -> connection) {
			$this -> connect();
		}

		$bind = $this -> parse($params, $query);

		//Write time for debugging
		if(null === $this -> trace) {
			$this -> trace = microtime(true);	
		}
		
		//Prepare statement
		$stmt = $this -> connection -> prepare($query);

		if(false === $stmt) {
			return trigger_error($this -> connection  -> error, E_USER_ERROR);
		}

		if(count($bind) > 0) {

			if(false === ($stmt -> param_count == count($bind) - 1)) {
				return trigger_error('Number of variable elements query string does not match number of bind variables');
			}

			call_user_func_array([$stmt, 'bind_param'], $bind);
		}

		$this -> stmt[] = $stmt;
		$this -> shadow = $this -> stmt;

		return $this;
	}
1214782
public function search(string $query, array $arguments = null)
    {
        $args = ['q' => $query];
        if (is_array($arguments)) {
            $args = array_merge($arguments, $args);
        }
        return new SearchIterator($this, 'search/tweets', $args);
    }
870187
public function pre_get_posts( \WP_Query &$wp_query ){
        if( !is_admin() && $wp_query->is_main_query() && ($api_class = $wp_query->get($this->api_class)) ){
            // Detect class is valid
            try{
                // Fix escaped namespace delimiter
                $api_class = str_replace('\\\\', '\\', $api_class);
                // Check class existence
                if( !$this->is_valid_class($api_class) ){
                    throw new \Exception($this->__('Specified URL is invalid.'), 404);
                }
                /** @var RestBase $instance */
                $instance = $api_class::get_instance();
                $instance->parse_request($wp_query->get($this->api_vars), $wp_query);
            }catch ( \Exception $e ){
                switch( $e->getCode() ){
                    case 404:
                        $wp_query->set_404();
                        break;
                    case 200:
                    case 201:
                        // If status is O.K.
                        // Do nothing.
                        break;
                    default:
                        wp_die($e->getMessage(), get_status_header_desc($e->getCode()), [
                            'response' => $e->getCode(),
                            'back_link' => true,
                        ]);
                        break;
                }
            }
        }
    }
360718
public function searchParent($query = null, $postType = null)
    {
        if (defined('DOING_AJAX') && DOING_AJAX) {
            $query = $_POST['query'];
            $postType = $_POST['postType'];
        }

        $search = new \WP_Query(array(
            'post_type' => $postType,
            'post_status' => array('publish', 'future', 'draft', 'pending', 'private'),
            's' => $query
        ));

        if (defined('DOING_AJAX') && DOING_AJAX) {
            echo json_encode($search->posts);
            wp_die();
        }

        return $search->posts;
    }
832531
public function insert($query, $args = array())
    {
        if ($this->exec($query, $args)) {
            return $this->getLastInsertId();
        }
        return false;
    }
712237
protected function run( $query, $bindings, Closure $callback ) {
		$start = microtime( true );

		// Prevent showing the errors.
		$suppress_errors = $this->wpdb->suppress_errors;
		$this->wpdb->suppress_errors( true );

		// Here we will run this query. If an exception occurs we'll determine if it was
		// caused by a connection that has been lost. If that is the cause, we'll try
		// to re-establish connection and re-run the query with a fresh connection.
		try {
			$result = $this->runQueryCallback( $query, $bindings, $callback );
		} catch ( \Exception $e ) {
			$result = $this->handleQueryException( $e, $query, $bindings );
		}

		// Once we have run the query we will calculate the time that it took to run and
		// then log the query, bindings, and execution time so we will report them on
		// the event that the developer needs them. We'll log time in milliseconds.
		$this->logQuery( $query, $bindings, $this->getElapsedTime( $start ) );

		$this->wpdb->suppress_errors( $suppress_errors );

		return $result;
	}
1089798
public function checkCommand(array $callback_query) : bool
    {
        if (isset($callback_query['data'])) {
            // If command is found in callback data
            if (strpos($this->data, $callback_query['data']) !== false) {
                return true;
            }
        }

        return false;
    }
1125147
public void printQuery(final Query query) {
	if (query != null) {
	    final String[] cols = query.getColumns();
	    final int rows = query.getRowCount();
	    System.out.println("[Query:" + query.getName() + "]");
	    for (int i = 0; i < cols.length; i++) {
		if (i > 0) System.out.print(", ");
		System.out.print(cols[i]);
	    }
	    System.out.println();

	    for (int row = 1; row <= rows; row++) {
		for (int col = 1; col <= cols.length; col++) {
		    if (col > 1) System.out.print(", ");
		    System.out.print(escapeString(query.getData(row, col)));
		}
		System.out.println();
	    }
	}
    }
905847
private function doQuery($query, $title) {
		if (preg_match('/\{\{#ask:([^}]*)\}\}/', $query, $matches) == 1) {
			$parts = explode("|", $matches[1]);
			$query = array_shift($parts);
			
			$params = [];
			foreach($parts as $p) {
				$keyValue = explode("=", $p);
				$params[trim($keyValue[0])] = trim($keyValue[1]);
			}
			$out = QueryUtils::executeCountQuery ( $query, [], $params )->getCountValue();
		} else {
			// assume $query is wikitext
			global $wgParser;
			$popt = new ParserOptions();
			$out = strip_tags($wgParser->parse( $query, $title, $popt )->getRawText());
		}
		return $out;
	}
739073
private function postType(\WP_Query $query)
    {
        $type = $query->get('post_type');
        is_array($type) and $type = reset($type);

        $object = get_post_type_object($type);
        (is_object($object) && $object->has_archive) or $type = '';

        return $type;
    }
93662
private function sendQuery($query, array $data = null) {
        if (!is_null($data)) {
            $Template = new QueryTemplate();
            $Template->load($query);
            pg_send_query($this->Resource, $Template->parse($data));
        } else {
            pg_send_query($this->Resource, $query);
        }
    }
553900
public function scopeAdvancedSearch(Builder $query, ?string $search, ?array $columns = null): Builder
    {
        ['basic' => $basic, 'advanced' => $advanced] = $this->resolveSearchKeywords($search ?? '');
        $rules = $this->getSearchableRules();
        $others = [];

        foreach ($rules as $keyword => $callback) {
            if (Str::contains($keyword, ':*') || Str::contains($keyword, ':[]')) {
                [$tag, $type] = \explode(':', $keyword, 2);

                $results = Arr::where($advanced, function ($value) use ($tag) {
                    return Str::startsWith($value, "{$tag}:");
                });

                $query->unless(empty($results), function ($query) use ($callback, $results, $type) {
                    if ($type === '*') {
                        [, $value] = \explode(':', $results[0] ?? null, 2);
                        $value = \trim($value, '"');
                    } else {
                        $value = \array_map(function ($text) {
                            [, $value] = \explode(':', $text, 2);

                            return \trim($value, '"');
                        }, $results);
                    }

                    \call_user_func($callback, $query, $value);

                    return $query;
                });
            } else {
                $query->when(\in_array($keyword, $advanced), function ($query) use ($callback) {
                    \call_user_func($callback, $query);

                    return $query;
                });
            }
        }

        if (\is_null($columns) && \method_exists($this, 'getSearchableColumns')) {
            $columns = $this->getSearchableColumns();
        }

        return $this->setupWildcardQueryFilter($query, $basic, $columns ?? []);
    }
1277233
public function posts_search(
		/** @noinspection PhpUnusedParameterInspection */
		$search, $wp_query
	) {
		if ( ! $wp_query->is_search() || ! $wp_query->is_main_query() || ! is_admin() || empty( $wp_query->query_vars['search_terms'] ) ) {
			return $search;
		}

		$fields = $this->get_search_fields();
		if ( empty( $fields ) ) {
			return $search;
		}

		global $wpdb;

		$exclusion_prefix = apply_filters( 'wp_query_search_exclusion_prefix', '-' );
		$search           = '';
		$q                = $wp_query->query_vars;
		$n                = ! empty( $q['exact'] ) ? '' : '%';
		$table            = $this->app->db->get_table( $this->get_related_table_name() );

		foreach ( $q['search_terms'] as $term ) {
			$exclude = $exclusion_prefix && ( $exclusion_prefix === substr( $term, 0, 1 ) );
			if ( $exclude ) {
				$like_op  = 'NOT LIKE';
				$andor_op = 'AND';
				$term     = substr( $term, 1 );
			} else {
				$like_op  = 'LIKE';
				$andor_op = 'OR';
			}

			$conditions = [];
			$fields     = array_map( function ( $field ) use ( $table ) {
				return "{$table}.{$field}";
			}, $fields );
			$fields[]   = "{$wpdb->posts}.post_title";
			$fields[]   = "{$wpdb->posts}.post_excerpt";
			$fields[]   = "{$wpdb->posts}.post_content";
			$like       = $n . $wpdb->esc_like( $term ) . $n;
			foreach ( $fields as $field ) {
				$conditions[] = $wpdb->prepare( "({$field} $like_op %s)", $like );
			}
			$conditions = implode( " {$andor_op} ", $conditions );
			$search     .= " AND ({$conditions})";
		}

		return $search;
	}