Filters by topic. Doesn't look at specific attributes –instead, actually joins to the topics table.
428046
public function filterByTopic($topic)
    {
        if (is_object($topic)) {
            $treeNodeID = $topic->getTreeNodeID();
        } else {
            $treeNodeID = $topic;
        }
        $paramName = $this->query->createNamedParameter($treeNodeID, \PDO::PARAM_INT);
        $query = $this->query->getConnection()->createQueryBuilder();
        $query
            ->select('cavTopics.cID', 'cavTopics.cvID')
            ->from('CollectionAttributeValues', 'cavTopics')
            ->innerJoin('cavTopics', 'AttributeValues', 'av', 'cavTopics.avID = av.avID')
            ->innerJoin('av', 'atSelectedTopics', 'atst', 'av.avID = atst.avID')
            ->where('atst.treeNodeID = ' . $paramName)
        ;
        $this->query
            ->andWhere(
                $this->query->expr()->in('(cv.cID,cv.cvID)', $query->getSQL())
            )
        ;
    }
941485
function _sortByAlpha(topics) {
            return topics
                .map(d => d)
                .sort((a, b) => {
                    if (a.name > b.name) return 1;
                    if (a.name === b.name) return 0;

                    return -1;
                });

            let otherIndex = topics.map(({ name }) => name).indexOf('Other');

            if (otherIndex >= 0) {
                let other = topics.splice(otherIndex, 1);

                topics = topics.concat(other);
            }
        }
1132735
def filter(self, table, users, filter_string):
        """"""
        q = filter_string.lower()
        return [user for user in users
                if (q in user.name.lower() or
                    q in (getattr(user, 'email', None) or '').lower())]
1080500
def filter(self, table, snapshots, filter_string):
        """"""
        query = filter_string.lower()
        return [snapshot for snapshot in snapshots
                if query in snapshot.name.lower()]
735237
def filter(self, table, group_types, filter_string):
        """"""
        query = filter_string.lower()
        return [group_type for group_type in group_types
                if query in group_type.name.lower()]
1170233
final public function addTopics(TopicFilter ...$topics): self
    {
        foreach ($topics as $topic) {
            // Frequently used: topicName, make it an apart variable for easy access
            $topicName = $topic->getTopicFilter();
            if (\in_array($topicName, $this->topicHashTable, true) === false) {
                // Personally, I find this hacky as hell. However, using the SPL library there seems to be no other way
                $this->topicHashTable[] = $topicName;
                $this->topics->enqueue($topic);
            }
        }

        return $this;
    }
294715
def filter(self, table, domains, filter_string):
        """"""
        q = filter_string.lower()

        def comp(domain):
            if q in domain.name.lower():
                return True
            return False

        return filter(comp, domains)
199929
def filter_by_tag(issues, newer_tag = nil)
      issues.select do |issue|
        issue["first_occurring_tag"] == (newer_tag.nil? ? nil : newer_tag["name"])
      end
    end
980204
def topic_exists(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    topics = list_topics(region=region, key=key, keyid=keyid, profile=profile)
    return name in list(topics.values() + topics.keys())
456811
def replace_topics(self, topics):
        
        post_parameters = {
            'names': topics
        }
        headers, data = self._requester.requestJsonAndCheck(
            "PUT",
            self.url + "/topics",
            headers={'Accept': Consts.mediaTypeTopicsPreview},
            input=post_parameters
        )
239173
def filter(self, *args, **kwargs) -> "QuerySet":
        
        return self._filter_or_exclude(negate=False, *args, **kwargs)
357933
def filter_link(model_class, filter_name, filters: {}, url_params: {})
      is_all = filter_name == :all
      config = filters[filter_name] || {}
      label = is_all ? all_label : filter_label(filter_name, filters)
      url_params =
        if config[:default] then index_params.except(:filter).merge(url_params)
        else index_params.merge(filter: filter_name).merge(url_params)
        end
      index_link(model_class, url_params: url_params) { label }
    end
904335
function(topicArray) {
    var regexArray = [];
    topicArray.forEach(function(filterString) {
      var regex = filterString.replace(/\/\+/g,'\\/.+').replace(/\/#$/g,'');
      regexArray.push(new RegExp(regex));
    });
    return regexArray;
  }
724343
def prefix_topic(self, topics):
        
        if not self.topic_prefix or not topics:
            return topics

        if not isinstance(topics, str) and isinstance(topics, collections.Iterable):
            return [self.topic_prefix + topic for topic in topics]

        return self.topic_prefix + topics
625288
def get_all_topics(region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    cache_key = _cache_get_key()
    try:
        return __context__[cache_key]
    except KeyError:
        pass

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    __context__[cache_key] = {}
    # TODO: support >100 SNS topics (via NextToken)
    topics = conn.get_all_topics()
    for t in topics['ListTopicsResponse']['ListTopicsResult']['Topics']:
        short_name = t['TopicArn'].split(':')[-1]
        __context__[cache_key][short_name] = t['TopicArn']
    return __context__[cache_key]
706704
def filtered(self, *, type_=None, lang=None, attrs={}):
        
        return list(self.filter(type_=type_, lang=lang, attrs=attrs))
1006498
def discussions_for(user, only_open=True):
    '''
    
    '''
    # Only fetch required fields for discussion filtering (id and slug)
    # Greatly improve performances and memory usage
    datasets = Dataset.objects.owned_by(user.id, *user.organizations).only('id', 'slug')
    reuses = Reuse.objects.owned_by(user.id, *user.organizations).only('id', 'slug')

    qs = Discussion.objects(subject__in=list(datasets) + list(reuses))
    if only_open:
        qs = qs(closed__exists=False)
    return qs