Returns every query and every match in checked_ids, with best score.
430605
def keep_everything_scorer(checked_ids):
    """"""
    result = checked_ids.keys()
    for i in checked_ids.values():
        result.extend(i.keys())
    return dict.fromkeys(result).keys()
113563
def query_all_issues(after):
    """"""
    page = count(1)
    data = []
    while True:
        page_data = query_issues(next(page), after)
        if not page_data:
            break
        data.extend(page_data)
    return data
898716
def index_all(klass, ids, options = {})
      Entry.enqueue(self, klass, ids, false, options[:priority] || self.class.default_priority)
    end
354753
def query_all():
        '''
        
        '''
        recs = TabPost2Tag.select(
            TabPost2Tag,
            TabTag.kind.alias('tag_kind'),
        ).join(
            TabTag,
            on=(TabPost2Tag.tag_id == TabTag.uid)
        )
        return recs
695110
def get_all(cls):
        
        issues = db.Issue.find(
            Issue.issue_type_id == IssueType.get(cls.issue_type).issue_type_id
        )

        return {res.issue_id: cls(res) for res in issues}
820190
def resolve_using_maximal_coverage(matches):
    
    if len(matches) == 0:
        return matches
    matches.sort()
    N = len(matches)
    scores = [len(match) for match in matches]
    prev = [-1] * N
    for i in range(1, N):
        bestscore = -1
        bestprev = -1
        j = i
        while j >= 0:
            # if matches do not overlap
            if matches[j].is_before(matches[i]):
                l = scores[j] + len(matches[i])
                if l >= bestscore:
                    bestscore = l
                    bestprev = j
            else:
                # in case of overlapping matches
                l = scores[j] - len(matches[j]) + len(matches[i])
                if l >= bestscore:
                    bestscore = l
                    bestprev = prev[j]
            j = j - 1
        scores[i] = bestscore
        prev[i] = bestprev
    # first find the matching with highest combined score
    bestscore = max(scores)
    bestidx = len(scores) - scores[-1::-1].index(bestscore) -1
    # then backtrack the non-conflicting matchings that should be kept
    keepidxs = [bestidx]
    bestidx = prev[bestidx]
    while bestidx != -1:
        keepidxs.append(bestidx)
        bestidx = prev[bestidx]
    # filter the matches
    return [matches[idx] for idx in reversed(keepidxs)]
766759
def hits(self):
        
        self.quality_sort()

        hits = dict((query, list(blines)) for (query, blines) in \
                        groupby(self, lambda x: x.query))

        self.ref_sort()

        return hits
1062376
def recentMatches(self, **criteria):
        """"""
        if not self.matches: return [] # no match history
        try: # maxMatches is a specially handled parameter (not true criteria)
            maxMatches = criteria["maxMatches"]
            del criteria["maxMatches"]
        except AttributeError:
            maxMatches = c.RECENT_MATCHES
        alLMatches = self.matchSubset(**criteria)
        matchTimes = [(m.endTime, m) for m in matches]
        selMatches = sorted(matchTimes)[:maxMatches] # slice off X most recet matches
        retMatches = [m for endTime,m in selMatches] # extract matches only
        return retMatches
540552
def find_all_checks(self, **kwargs):
        
        found = []
        searches = kwargs.items()
        for obj in self.list():
            try:
                if all(getattr(obj, attr) == value
                        for (attr, value) in searches):
                    found.append(obj)
            except AttributeError:
                continue
        return found
1120703
def all(self):
        
        identifiers = []

        query = text("""
            SELECT identifier, type, name
            FROM identifier_index;""")

        for result in self.backend.library.database.connection.execute(query):
            vid, type_, name = result
            res = IdentifierSearchResult(
                score=1, vid=vid, type=type_, name=name)
            identifiers.append(res)
        return identifiers
652
protected function findIdsByGivenCriteria()
    {
        $select = $this->getSelectAs($this->idField);

        $subQueryBuilder = $this->createSubQueryBuilder($select);
        if (null != $this->limit) {
            $subQueryBuilder->setMaxResults($this->limit)->setFirstResult($this->limit * ($this->page - 1));
        }

        foreach ($this->sortFields as $index => $sortField) {
            if ($sortField->getName() !== $this->idField->getName()) {
                $subQueryBuilder->addSelect($this->getSelectAs($sortField));
            }
        }

        $this->assignSortFields($subQueryBuilder);
        $this->assignParameters($this->queryBuilder);
        $ids = $subQueryBuilder->getQuery()->getArrayResult();

        // if no results are found - return
        if (count($ids) < 1) {
            return [];
        }

        $ids = array_map(
            function($array) {
                return $array[$this->idField->getName()];
            },
            $ids
        );

        return $ids;
    }
210631
def all(self):
        
        datasets = []

        query = text("""
            SELECT vid
            FROM dataset_index;""")

        for result in self.execute(query):
            res = DatasetSearchResult()
            res.vid = result[0]
            res.b_score = 1
            datasets.append(res)
        return datasets
417016
def __select_autocomplete_identities(self, sources):
        """"""

        MIN_PRIORITY = 99999999

        checked = {}

        for source in sources:
            uids = api.unique_identities(self.db, source=source)

            for uid in uids:
                if uid.uuid in checked:
                    continue

                max_priority = MIN_PRIORITY
                selected = []

                for identity in sorted(uid.identities, key=lambda x: x.id):
                    try:
                        priority = sources.index(identity.source)

                        if priority < max_priority:
                            selected = [identity]
                            max_priority = priority
                        elif priority == max_priority:
                            selected.append(identity)
                    except ValueError:
                        continue

                checked[uid.uuid] = selected

        identities = collections.OrderedDict(sorted(checked.items(),
                                             key=lambda t: t[0]))

        return identities
1365554
def _get_subset_matches(self, query):
        
        for field_name, db_index in self._get_db_fields(query):
            attr = getattr(query, field_name)

            if attr is None:  # don't use unset attributes
                continue

            results = db_index.get(attr, OOTreeSet())

            if results:
                yield results
81820
def best_hits(self):
        
        self.quality_sort()

        best_hits = dict((query, next(blines)) for (query, blines) in \
                        groupby(self, lambda x: x.query))

        self.ref_sort()

        return best_hits
866079
def get_all(kind='2'):
        '''
        
        '''
        return TabPost.select().where(
            (TabPost.kind == kind) &
            (TabPost.valid == 1)
        ).order_by(
            TabPost.time_update.desc()
        )
347311
def all(self, query=None):
        

        if query is None:
            query = {}

        if self.content_type_id is not None:
            query['content_type'] = self.content_type_id

        normalize_select(query)

        return super(EntriesProxy, self).all(query=query)