Overridable find method for how to search a book

@param mixed $search

@return bool
160903
public function find( $search ) {

		if ( ! is_array( $search ) ) {
			$search = (array) $search;
		}

		foreach ( $search as $val ) {
			if ( $this->fulltextSearchInPost( $val ) !== false ) {
				return true;
			}
			if ( $this->fulltextSearchInMeta( $val ) !== false ) {
				return true;
			}
		}

		return false;
	}
498838
protected function paramSearchMeta( array $search ) {

		// Book Metadata
		$request_metadata = new \WP_REST_Request( 'GET', '/pressbooks/v2/metadata' );
		$response_metadata = rest_do_request( $request_metadata );
		$book_metadata = $response_metadata->get_data();
		if ( $this->keyValueSearchInMeta( $search, $book_metadata ) ) {
			return true;
		}

		// Chapter Metadata
		$request_metadata = new \WP_REST_Request( 'GET', '/pressbooks/v2/toc' );
		$response_metadata = rest_do_request( $request_metadata );
		$toc = $response_metadata->get_data();
		foreach ( $toc['front-matter'] as $fm ) {
			if ( $this->keyValueSearchInMeta( $search, $fm['metadata'] ) ) {
				return true;
			}
		}
		foreach ( $toc['parts'] as $p ) {
			foreach ( $p['chapters'] as $ch ) {
				if ( $this->keyValueSearchInMeta( $search, $ch['metadata'] ) ) {
					return true;
				}
			}
		}
		foreach ( $toc['back-matter'] as $bm ) {
			if ( $this->keyValueSearchInMeta( $search, $bm['metadata'] ) ) {
				return true;
			}
		}

		return false;
	}
105383
protected function capture($pattern, $search)
    {
        $replace = '(?<$1>' . self::ALLOWED_REGEX . ')';

        return preg_replace($search, $replace, $pattern);
    }
1071966
protected function searchField($search)
    {
        foreach ($this->data as $field) {
            if (method_exists($field, 'getField') && $find = $field->getField($search)) {
                return $find;
            }
        }
    }
980169
public function getSuggestions(string $search): Collection
    {
        $items = $this->model::where(
            [
                ['question', 'LIKE', '%'.$search.'%'],
            ]
        )->get();

        return $items;
    }
672158
public function simple_search($search)
	{
		$results = explode(';', $search);

		foreach ($results as $key => $result)
		{
			$results[$key] = '(' . $result . ')';
		}

		return $this->search($results);
	}
889987
public function findRaw(Search $search)
    {
        $results = $this->executeSearch($search);

        return new RawIterator(
            $results,
            $this->getManager(),
            $this->getScrollConfiguration($results, $search->getScroll())
        );
    }
911469
public function findByPaymentDetailsAndTransactionKey($search, $transactionKey)
    {
        $qb = $this->getQueryBuilder()
            ->select('t')
            ->where('t.paymentDetails LIKE :search')
            ->andWhere('t.transactionKey = :transactionKey')
            ->setParameters(array('search' => '%'.$search.'%', 'transactionKey' => $transactionKey));
         
        return $qb->getQuery()
            ->getOneOrNullResult();
    }
506261
public function searchComponents($search, $by, $limit = 1, $num = 1000, $page = 1)
    {
        $components = $this->indexComponents($num, $page)['data'];

        $filtered = array_filter(
            $components,
            function ($component) use ($search, $by) {

                if (array_key_exists($by, $component)) {
                    if (strpos($component[$by], $search) !== false) {
                        return $component;
                    }
                    if ($component[$by] === $search) {
                        return $component;
                    }
                }

                return false;
            }
        );

        if ($limit == 1) {
            return array_shift($filtered);
        }

        return array_slice($filtered, 0, $limit);
    }
1356538
private function search(&$search, $idx, $selectors, $level, $search_level = 0) {
		if ($search_level >= $level) {
			$rs = $this->seek($search, $selectors, $level - 1);
			if ($rs !== FALSE && $idx !== NULL) {
				if ($idx == count($this->_lFind)) {
					$this->_lFind[] = new self($rs);
					return TRUE;
				} else {
					$this->_lFind[] = new self($rs);
				}
			} elseif ($rs !== FALSE) {
				$this->_lFind[] = new self($rs);
			}
		}
		if (!empty($search->childNodes)) {
			foreach ($search->childNodes as $val) {
				if ($this->search($val, $idx, $selectors, $level, $search_level + 1)) {
					return TRUE;
				}
			}
		}
		return FALSE;
	}
573117
public function intersection(array $search, bool $keepKeys = false): self
    {
        if ($keepKeys) {
            return static::create(
                \array_uintersect(
                    $this->array,
                    $search,
                    static function ($a, $b) {
                        return $a === $b ? 0 : -1;
                    }
                ),
                $this->iteratorClass,
                false
            );
        }

        return static::create(
            \array_values(\array_intersect($this->getArray(), $search)),
            $this->iteratorClass,
            false
        );
    }
1182576
public static function searchType($search)
    {
        //typ podany explicit
        if (self::getExtensionByType($search)) {
            return $search;
        }
        //typ znaleziony na podstawie rozszerzenia
        if (isset(self::$_contentTypes[$search])) {
            return self::$_contentTypes[$search];
        }
        //typ nieodnaleziony
        throw new HttpException('Type not found');
    }
415522
public function setSearch($search)
    {
        $this->_search = $search;
        $this->_queryBuilder->setSearch($search);
        return $this;
    }
425619
public function find($cacheKey)
    {
        $key = array_search($cacheKey, $this->cachedKeys);

        if ($key != false and ! $this->cache->has($key))
        {
            unset($this->cachedKeys[$key]);
            $this->storeCachedKeys();

            return false;
        }

        return $key ? $this->cache->get($key) : false;
    }
834647
public function isSearchable()
    {
        if (request()->has('inline_search')) {
            $this->replace([
                'start'  => 0,
                'length' => 25,
                'search' => request()->get('inline_search')
            ]);
        }
        $search = (array) $this->get('search');
        return isset($search['value']) ? $search['value'] != '' : false;
    }
757351
public function addSearch(BaseSearch $search, string $key = null): self
    {
        if ($key) {
            $this->_searches[$key] = $search;
        } else {
            $this->_searches[] = $search;
        }

        return $this;
    }
453016
private function executeSearch(Search $search)
    {
        return $this->getManager()->search([$this->getType()], $search->toArray(), $search->getUriParams());
    }