Calculates all relevant cache tags for a search requests. Considers all accessed fields of the criteria.
192475
public function getSearchTags(EntityDefinition $definition, Criteria $criteria): array
    {
        $tags = [$definition->getEntityName() . '.id'];

        foreach ($criteria->getSearchQueryFields() as $accessor) {
            foreach ($this->getFieldsOfAccessor($definition, $accessor) as $association) {
                $tags[] = $association;
            }
        }

        return $tags;
    }
1118468
def get_top_tags(self, limit=None, cacheable=True):
        

        params = self._get_params()
        if limit:
            params["limit"] = limit

        doc = self._request(self.ws_prefix + ".getTopTags", cacheable, params)

        seq = []
        for node in doc.getElementsByTagName("tag"):
            seq.append(
                TopItem(
                    Tag(_extract(node, "name"), self.network), _extract(node, "count")
                )
            )

        return seq
84392
def find(query = {})
      query = query.map { |k, v| [FIELDS[k], v] if FIELDS[k] }.compact.to_h
      resource = query.delete(RESOURCE)
      matches = validate(
        find_all_cached_entries(
          query.reverse_merge(
            authority: @authority, client_id: @client.client_id))
      )
      resource_specific(matches, resource) || refresh_mrrt(matches, resource)
    end
106117
def tags(self):
        
        tags = self.fields['tags']
        return [(t, v) for t in tags for v in tags[t]]
601882
def procces_filters(all_needs, current_needlist):
    

    if current_needlist["sort_by"] is not None:
        if current_needlist["sort_by"] == "id":
            all_needs = sorted(all_needs, key=lambda node: node["id"])
        elif current_needlist["sort_by"] == "status":
            all_needs = sorted(all_needs, key=status_sorter)

    found_needs_by_options = []

    # Add all need_parts of given needs to the search list
    all_needs_incl_parts = prepare_need_list(all_needs)

    for need_info in all_needs_incl_parts:
        status_filter_passed = False
        if current_needlist["status"] is None or len(current_needlist["status"]) == 0:
            # Filtering for status was not requested
            status_filter_passed = True
        elif need_info["status"] is not None and need_info["status"] in current_needlist["status"]:
            # Match was found
            status_filter_passed = True

        tags_filter_passed = False
        if len(set(need_info["tags"]) & set(current_needlist["tags"])) > 0 or len(current_needlist["tags"]) == 0:
            tags_filter_passed = True

        type_filter_passed = False
        if need_info["type"] in current_needlist["types"] \
                or need_info["type_name"] in current_needlist["types"] \
                or len(current_needlist["types"]) == 0:
            type_filter_passed = True

        if status_filter_passed and tags_filter_passed and type_filter_passed:
            found_needs_by_options.append(need_info)

    found_needs_by_string = filter_needs(all_needs_incl_parts, current_needlist["filter"])

    # found_needs = [x for x in found_needs_by_string if x in found_needs_by_options]

    found_needs = check_need_list(found_needs_by_options, found_needs_by_string)

    return found_needs
258936
protected function cache()
    {
        if ($this->supportsTags === null) {
            $this->determineTagSupport();
        }

        if ($this->supportsTags) {
            return $this->cache->tags($this->tag);
        }

        return $this->cache;
    }
383073
def search_related(self, request):
        logger.debug("Cache Search Request")
        if self.cache.is_empty() is True:
            logger.debug("Empty Cache")
            return None

        
        result = []
        items = list(self.cache.cache.items())

        for key, item in items:
            element = self.cache.get(item.key)
            logger.debug("Element : {elm}".format(elm=str(element)))

            if request.proxy_uri == element.uri:
                result.append(item)

        return result
475075
def set_to_cache(self):
        
        queryset = self.get_queryset()
        cache.set(self._get_cache_key(), {
            'queryset':
                [
                    queryset.none(),
                    queryset.query,
                ],
            'cls': self.__class__,
            'search_fields': tuple(self.search_fields),
            'max_results': int(self.max_results),
            'url': str(self.get_url()),
            'dependent_fields': dict(self.dependent_fields),
        })
518291
def _update_cache(self):
        
        fields = connections[self.connection_alias].get_unified_index().all_searchfields()
        if self._fields != fields:
            self._fields = fields
            self._content_field_name, self._schema = self.build_schema(self._fields)
1338662
def search_fields(self):
        
        search_fields = self.request.get("search_fields", None)
        if not search_fields:
            return []

        search_fields = json.loads(_u(search_fields))
        return search_fields
537727
def get_tags(self):
        """"""

        # Uncacheable because it can be dynamically changed by the user.
        params = self._get_params()

        doc = self._request(self.ws_prefix + ".getTags", False, params)
        tag_names = _extract_all(doc, "name")
        tags = []
        for tag in tag_names:
            tags.append(Tag(tag, self.network))

        return tags
111793
def get_all_tags_names_as_list(self, admin=False, language="en"):
        

        if admin:
            if self._all_tags_cache_list_admin != {} and language in self._all_tags_cache_list_admin:
                return self._all_tags_cache_list_admin[language] #Cache hit
        else:
            if self._all_tags_cache_list != {} and language in self._all_tags_cache_list:
                return self._all_tags_cache_list[language] #Cache hit
                        
        #Cache miss, computes everything
        s_stud = set()
        s_admin = set()
        (common, _, org) = self.get_all_tags()
        for tag in common + org:
            # Is tag_name_with_translation correct by doing that like that ?
            tag_name_with_translation = self.gettext(language, tag.get_name()) if tag.get_name() else ""
            s_admin.add(tag_name_with_translation) 
            if tag.is_visible_for_student():
                s_stud.add(tag_name_with_translation) 
        self._all_tags_cache_list_admin[language] = natsorted(s_admin, key=lambda y: y.lower())
        self._all_tags_cache_list[language] = natsorted(s_stud, key=lambda y: y.lower())
        
        if admin:
            return self._all_tags_cache_list_admin[language]
        return self._all_tags_cache_list[language]
569803
protected function computeInQueryParameters()
	{
		foreach ($this->openApiFileContent['paths'] as $path => $operations) {
			foreach ($operations as $httpMethod => $operation) {
				if (isset($operation['tags'])) {
					$extractedTags = [];
					foreach ($operation['tags'] as $tag) {
						$split = explode(':', $tag);
						if (count($split) == 2) {
							switch ($split[0]) {
								case 'Manager' :
									if (!isset($extractedTags['Managers'])) {
										$extractedTags['Managers'] = [];
									}
									$extractedTags['Managers'][] = $split[1];
									break;
								case 'Resource' :
									if (!isset($extractedTags['Resources'])) {
										$extractedTags['Resources'] = [];
									}
									$extractedTags['Resources'][] = $split[1];
									break;
							}
						}
					}

					foreach ($extractedTags as $tagType => $typeTags) {
						foreach ($typeTags as $typeTag) {
							switch ($tagType) {
								case 'Managers' :
									$this->managersData[ucfirst($typeTag)]['routes'][$operation['operationId']]['inQueryParameters'] = $this->getRouteOperationInQueryParameters($operation);
									break;

								case 'Resources' :
									$this->resourcesData[ucfirst($typeTag)]['routes'][$operation['operationId']]['inQueryParameters'] = $this->getRouteOperationInQueryParameters($operation, ucfirst($typeTag), $this->resourcesData[ucfirst($typeTag)]['properties']);
									break;
							}
						}
					}
				}
			}
		}
	}
507487
def query(self, search, query):
        
        if query:
            if self.fields:
                return search.query('multi_match', fields=self.fields, query=query)
            else:
                return search.query('multi_match', query=query)
        return search
652246
def get_tags_recommendation(request):
    
    query = request.GET.get('query')
    limit = settings.TAGGIT_SELECTIZE['RECOMMENDATION_LIMIT']

    try:
        cls = import_string(settings.TAGGIT_SELECTIZE_THROUGH)
    except AttributeError:
        cls = Tag

    if query:
        tags = cls.objects.filter(name__icontains=query).values('name')[:limit]
    else:
        tags = cls.objects.values()[:limit]

    data = json.dumps({
        'tags': list(tags)
    })

    return HttpResponse(data, content_type='application/json')
1364485
@Override
    public int purgeCacheEntries(CacheEntryTag tag) {
        final String tagType = tag.getTagType();
        final Set<Ehcache> caches = taggedCaches.getIfPresent(tagType);

        // Tag exists in cache(s)
        if (caches == null || caches.isEmpty()) {
            return 0;
        }

        int purgeCount = 0;

        // Iterate over each cache to remove the tagged entries
        for (final Ehcache cache : caches) {
            final String cacheName = cache.getName();

            // See if there are any tagged cache keys for the cache
            final LoadingCache<CacheEntryTag, Set<Object>> cacheKeys =
                    taggedCacheKeys.getIfPresent(cacheName);
            if (cacheKeys != null) {

                // Remove all cache keys from the cache
                final Set<Object> taggedKeys = cacheKeys.asMap().remove(tag);
                if (taggedKeys != null) {
                    final int keyCount = taggedKeys.size();
                    purgeCount += keyCount;
                    logger.debug("Removing {} keys from {} for tag {}", keyCount, cacheName, tag);

                    cache.removeAll(taggedKeys);
                }
            }
        }

        return purgeCount;
    }
820044
def tags(self):
        
        if self._tags is None:
            LOG.debug('need to build tags')
            self._tags = {}

            if hasattr(self.Meta, 'tags_spec') and (self.Meta.tags_spec is not None):
                LOG.debug('have a tags_spec')
                method, path, param_name, param_value = self.Meta.tags_spec[:4]
                kwargs = {}
                filter_type = getattr(self.Meta, 'filter_type', None)
                if filter_type == 'arn':
                    kwargs = {param_name: [getattr(self, param_value)]}
                elif filter_type == 'list':
                    kwargs = {param_name: [getattr(self, param_value)]}
                else:
                    kwargs = {param_name: getattr(self, param_value)}
                if len(self.Meta.tags_spec) > 4:
                    kwargs.update(self.Meta.tags_spec[4])
                LOG.debug('fetching tags')
                self.data['Tags'] = self._client.call(
                    method, query=path, **kwargs)
                LOG.debug(self.data['Tags'])

            if 'Tags' in self.data:
                _tags = self.data['Tags']
                if isinstance(_tags, list):
                    for kvpair in _tags:
                        if kvpair['Key'] in self._tags:
                            if not isinstance(self._tags[kvpair['Key']], list):
                                self._tags[kvpair['Key']] = [self._tags[kvpair['Key']]]
                            self._tags[kvpair['Key']].append(kvpair['Value'])
                        else:
                            self._tags[kvpair['Key']] = kvpair['Value']
                elif isinstance(_tags, dict):
                    self._tags = _tags
        return self._tags