Returns array of arrays representing tags that partially match the given search term

@param string $term
@return array
350533
protected function getTags($term)
    {
        $items = [];
        foreach ($this->getOptions() as $i => $tag) {
            /** @var ArrayData $tag */
            $tagValue = $tag->Value;
            // Map into a distinct list (prevent duplicates)
            if (stripos($tagValue, $term) !== false && !array_key_exists($tagValue, $items)) {
                $items[$tagValue] = [
                    'id' => $tag->Title,
                    'text' => $tag->Value,
                ];
            }
        }
        // @todo do we actually need lazy loading limits for StringTagField?
        return array_slice(array_values($items), 0, $this->getLazyLoadItemLimit());
    }
1188382
public function sortSearchResults($results, $term)
    {
        $sortedResults = [];

        if (!empty($results)) {
            foreach ($results as $result) {
                if (stripos($result->getTitle(), $term) !== false) {
                    array_unshift($sortedResults, $result);
                } else {
                    $sortedResults[] = $result;
                }
            }
        }

        return $sortedResults;
    }
876623
function get_suggestions($word)
    {
        $matches = $word ? $this->check($word) : $this->matches;

        if ($matches[0][4]) {
            return $matches[0][4];
        }

        return array();
    }
165880
public function findIdentifiersByTag($tag)
    {
        $tagsFiles = \glob(GeneralUtility::getFileAbsFileName(self::RELATIVE_STORAGE_FOLDER) . '*/*/*' . self::FILE_EXTENSION_TAG);
        $identifiers = [];
        foreach ($tagsFiles as $tagsFile) {
            if (false !== \mb_strpos(\file_get_contents($tagsFile), '|' . $tag . '|')) {
                $identifiers[] = \file_get_contents(\str_replace(self::FILE_EXTENSION_TAG, self::FILE_EXTENSION_IDENTIFIER, $tagsFile));
            }
        }

        return $identifiers;
    }
1113337
public function getSeoTags() {
        if($this->owner->seo) {
            $seo = $this->owner->seo->attributes;
            return array_filter(array_intersect_key($seo, array_flip(['meta_title', 'meta_keywords', 'meta_description'])));
        } else {
            return [];
        }
    }
1347040
protected function getTagsFromMySQL()
    {
        $queryParts = $this->getQueryParts();

        $queryBuilder = self::getQueryBuilder('tx_kesearch_index');
        $queryBuilder->getRestrictions()->removeAll();

        $tagRows = $queryBuilder
            ->select('tags')
            ->from($queryParts['FROM'])
            ->add('where', $queryParts['WHERE'])
            ->execute()
            ->fetchAll();

        return array_map(
            function ($row) {
                return $row['tags'];
            },
            $tagRows
        );
    }
1008043
protected function resolveSearchKeywords(string $keyword): array
    {
        $basic = [];
        $advanced = [];

        $tags = \array_map(function ($value) {
            [$tag, ] = \explode(':', $value, 2);

            return "{$tag}:";
        }, \array_keys($this->getSearchableRules()));

        if (\preg_match_all('/([\w]+:\"[\w\s]*\"|[\w]+:[\w\S]+|[\w\S]+)\s?/', $keyword, $keywords)) {
            foreach ($keywords[1] as $index => $keyword) {
                if (! Str::startsWith($keyword, $tags)) {
                    \array_push($basic, $keyword);
                } else {
                    \array_push($advanced, $keyword);
                }
            }
        }

        return [
            'basic' => \implode(' ', $basic),
            'advanced' => $advanced,
        ];
    }
908599
public function tagged($tag)
    {
        if (! isset($this->tags[$tag])) {
            return [];
        }

        return new RewindableGenerator(function () use ($tag) {
            foreach ($this->tags[$tag] as $abstract) {
                yield $this->make($abstract);
            }
        }, count($this->tags[$tag]));
    }
1234284
function get_suggestions($word)
    {
        $matches = $word ? $this->check($word) : $this->matches;

        if ($matches[0][4]) {
            $suggestions = explode("\t", $matches[0][4]);
            if (count($suggestions) > self::MAX_SUGGESTIONS) {
                $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
            }

            return $suggestions;
        }

        return array();
    }
36824
private function getAttributes($tag)
    {
        if (!preg_match_all(self::ATTRIBUTE_REGEX, $tag, $matches)) {
            return [];
        }

        $attributes = [];
        for ($i = 0, $length = count($matches['name']); $i < $length; ++$i) {
            $value = $matches['value'][$i];

            if ('true' === $value || 'false' === $value) {
                $value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
            }

            $attributes[$matches['name'][$i]] = $value;
        }

        return $attributes;
    }
1011135
protected function updateTags($entry)
    {
        if (! empty($entry->tagsChanges['added'])) {
            $this->table('telescope_entries_tags')->insert(
                collect($entry->tagsChanges['added'])->map(function ($tag) use ($entry) {
                    return [
                        'entry_uuid' => $entry->uuid,
                        'tag' => $tag,
                    ];
                })->toArray()
            );
        }

        collect($entry->tagsChanges['removed'])->each(function ($tag) use ($entry) {
            $this->table('telescope_entries_tags')->where([
                'entry_uuid' => $entry->uuid,
                'tag' => $tag,
            ])->delete();
        });
    }
816085
function( term ) {
        var split_term = term.split(' ');
        var matchers = [];
        for (var i=0; i < split_term.length; i++) {
          if ( split_term[i].length > 0 ) {
            var matcher = {};
            matcher['partial'] = new RegExp( $.ui.autocomplete.escapeRegex( split_term[i] ), "i" );
            if ( context.settings['relevancy-sorting'] ) {
              matcher['strict'] = new RegExp( "^" + $.ui.autocomplete.escapeRegex( split_term[i] ), "i" );
            }
            matchers.push( matcher );
          }
        };

        return $.grep( context.options, function( option ) {
          var partial_matches = 0;
          if ( context.settings['relevancy-sorting'] ) {
            var strict_match = false;
            var split_option_matches = option.matches.split(' ');
          }
          for ( var i=0; i < matchers.length; i++ ) {
            if ( matchers[i]['partial'].test( option.matches ) ) {
              partial_matches++;
            }
            if ( context.settings['relevancy-sorting'] ) {
              for (var q=0; q < split_option_matches.length; q++) {
                if ( matchers[i]['strict'].test( split_option_matches[q] ) ) {
                  strict_match = true;
                  break;
                }
              };
            }
          };
          if ( context.settings['relevancy-sorting'] ) {
            var option_score = 0;
            option_score += partial_matches * context.settings['relevancy-sorting-partial-match-value'];
            if ( strict_match ) {
              option_score += context.settings['relevancy-sorting-strict-match-value'];
            }
            option_score = option_score * option['relevancy-score-booster'];
            option['relevancy-score'] = option_score;
          }
          return (!term || matchers.length === partial_matches );
        });
      }
981781
public function search(...$tags): array
    {
        $this->validateTags($tags);
        if (!count($tags)) {
            return [];
        }
        $tags = array_unique($tags);
        $tags = array_map(function ($tag) {
            return self::PREFIX_TAG . $tag;
        }, $tags);
        $return = $this->client->evalsha(
            $this->scripts[self::SCRIPT_SEARCH],
            count($tags),
            ...$tags,
            ...[
                self::PREFIX_TAG,
                self::PREFIX_KEY_VALUE,
                self::PREFIX_KEY_TAGS,
            ]
        );
        return $return ?: [];
    }
698745
public function getIdsMatchingTags($tags = array())
    {
        $first = true;
        $ids = array();
        foreach ($tags as $tag) {
            $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='$tag'");
            if (!$res) {
                return array();
            }
            $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
            $ids2 = array();
            foreach ($rows as $row) {
                $ids2[] = $row['id'];
            }
            if ($first) {
                $ids = $ids2;
                $first = false;
            } else {
                $ids = array_intersect($ids, $ids2);
            }
        }
        $result = array();
        foreach ($ids as $id) {
            $result[] = $id;
        }
        return $result;
    }
46112
protected function getTags($value)
    {
        $tags = [];
        switch ($value) {
            case $value instanceof VersionList && !empty($value->versions):
                $tags[] = 'content-' . $value->versions[0]->contentInfo->id;
                $tags[] = 'content-versions-' . $value->versions[0]->contentInfo->id;

                break;

            case $value instanceof Section:
                $tags[] = 'section-' . $value->id;
                break;

            case $value instanceof ContentTypeGroupRefList:
                if ($value->contentType->status !== ContentType::STATUS_DEFINED) {
                    return [];
                }
                $tags[] = 'type-' . $value->contentType->id;
            case $value instanceof ContentTypeGroupList:
                foreach ($value->contentTypeGroups as $contentTypeGroup) {
                    $tags[] = 'type-group-' . $contentTypeGroup->id;
                }
                break;

            case $value instanceof RestContentType:
                $value = $value->contentType;
            case $value instanceof ContentType:
                if ($value->status !== ContentType::STATUS_DEFINED) {
                    return [];
                }
                $tags[] = 'type-' . $value->id;
                break;

            case $value instanceof Root:
                $tags[] = 'ez-all';
                break;

                // @deprecated The following logic is 1.x specific, and should be removed before a 1.0 version
            case $value instanceof PermissionReport:
                // We requrie v0.1.5 with added location property to be able to add tags
                if (!isset($value->parentLocation)) {
                    return [];
                }

                // In case of for instance location swap where content type might change affecting allowed content types
                $tags[] = 'content-' . $value->parentLocation->contentId;
                $tags[] = 'content-type-' . $value->parentLocation->contentInfo->contentTypeId;
                $tags[] = 'location-' . $value->parentLocation->id;

                // In case of permissions assigned by subtree, so if path changes affecting this (move subtree operation)
                foreach ($value->parentLocation->path as $pathItem) {
                    $tags[] = 'path-' . $pathItem;
                }
                break;
        }

        return $tags;
    }
697405
public function getTagsFromSearchResult()
    {
        $tags = $tagsForResult = array();
        $tagChar = $this->pObj->extConf['prePostTagChar'];
        $tagDivider = $tagChar . ',' . $tagChar;

        if ($this->sphinxSearchEnabled()) {
            $tagsForResult = $this->getTagsFromSphinx();
        } else {
            $tagsForResult = $this->getTagsFromMySQL();
        }
        foreach ($tagsForResult as $tagSet) {
            $tagSet = explode($tagDivider, trim($tagSet, $tagChar));
            foreach ($tagSet as $tag) {
                $tags[$tag] += 1;
            }
        }
        return $tags;
    }
885667
protected function getCoveredTags(array $tags)
    {
        // Finds for actual tag names
        $matched = [];
        foreach ($this->tagCoverageList as $original) {
            $actual = $this->tagSearch($original, $tags);
            if (null !== $actual) {
                $matched[] = $actual;
            }
        }

        // Whitelist
        if ('whitelist' === $this->tagCoverageStrategy) {
            return $matched;
        }

        // Blacklist
        return array_values(array_diff($tags, $matched));
    }