Return list of matching records. criteria is a dict of {field: value}

        >>> s = teststore()
        >>> s.list('tstoretest')
        []
760218
def list(self, cls, criteria=None):
        
        self.validate_criteria(cls, criteria)
        return self.db.select(cls, where=criteria)
979070
def _get_candidates(self, v):
        
        candidates = []
        for lshash in self.lshashes:
            for bucket_key in lshash.hash_vector(v, querying=True):
                bucket_content = self.storage.get_bucket(
                    lshash.hash_name,
                    bucket_key,
                )
                #print 'Bucket %s size %d' % (bucket_key, len(bucket_content))
                candidates.extend(bucket_content)
        return candidates
1272465
def iterateFilteredRecords( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
      fields = []
      regexp = {}
      fieldNames.each{|field|
         if field.is_a?(Hash)
            fields << field.keys[0]
            regexp[field.keys[0]] = field.values[0]
         elsif field.is_a?(String)
            fields << field
         end
      }
      regexp = nil if regexp.length == 0
      iterateRecords(dbid,fields,query,qid,qname,clist,slist,fmt,options){|record|
         if regexp
            match = true
            fields.each{|field|
               if regexp[field] 
                  unless record[field] and record[field].match(regexp[field])
                     match = false 
                     break
                  end
               end
            }
            yield record if match
         else
            yield record
         end
      }
   end
1265231
def value(self, item=0, default=None):
        
        return [record.value(item, default) for record in self.records()]
605814
public List list(Class clazz, String key, Object value)
    {
        QueryCriteria criteria = new QueryCriteria(key, QueryCriteriaOperator.EQUAL, value);
        Query query = new Query(clazz, criteria);
        try {
            return persistenceManager.executeLazyQuery(query);
        } catch (InitializationException ignore){}
        catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }
940211
def _val_fs_regex(self, record, hist=None):
        

        record, hist = self.data_regex_method(fields_list=self.fields,
                                              mongo_db_obj=self.mongo,
                                              hist=hist,
                                              record=record,
                                              lookup_type='fieldSpecificRegex')
        return record, hist
371415
List getOrderby()
    {
        List result = _getOrderby();
        Iterator iter = getCriteria().iterator();
        Object crit;

        while (iter.hasNext())
        {
            crit = iter.next();
            if (crit instanceof Criteria)
            {
                result.addAll(((Criteria) crit).getOrderby());
            }
        }

        return result;
    }
706127
def get_list(self, method="list", **kwargs):
        

        lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3]))
        lg.setLevel(self.log_level)

        args = inspect.getargvalues(inspect.currentframe())[3]
        lg.debug("\n****** Args *****:\n%s",
                 pp.pformat(args))

        es = kwargs.get("es",self.es)
        doc_type = get2(kwargs, "doc_type", self.doc_type)
        id_field = get2(kwargs, "id_field", "_id")
        value_fld = kwargs.get("value_fld")
        fields = kwargs.get("fields")
        sort_dir = get2(kwargs,"sort_dir", "asc")
        sort_fields = get2(kwargs,"sort_fields", get2(kwargs, "fields", [value_fld]))
        size = get2(kwargs,"size",2000)
        term = get2(kwargs,"term",'').replace("/","//")
        filter_field = kwargs.get('filter_field')
        filter_value = kwargs.get('filter_value')
        dsl = {}
        # set retutn to only return the fields specified or return the whole
        # document if not specified
        if fields is not None:
            dsl["_source"] = fields
        elif value_fld is not None:
            dsl["_source"] = [value_fld]
            fields = [value_fld]
        else:
            fields = []
        # set query parameters based on the return method "list" or "search"
        if sort_dir != "none" and method == "list":
            dsl["sort"] = []
            for fld in sort_fields:
                if fld is not None:
                    dsl["sort"].append({ fld: sort_dir })
        if method == "search":
            # query in elasticsearch breaks if the is a single open parenthesis
            # remove a single parenthesis from the search term
            if "(" in term and ")" not in term:
                search_term = term.replace("(", "")
            else:
                search_term = term
            size = 5
            dsl['query'] =  {
                "bool": {
                    "should": [
                        {
                            "query_string" : {
                                "analyze_wildcard": {
                                    "query": "*%s*" % search_term
                                }

                            }
                        },
                        {
                            "query_string" : {
                                "query": "*%s*" % search_term,
                                "analyzer": "default",
                                "analyze_wildcard": True,
                                "fields": fields,
                                "boost": 10
                            }
                        }
                    ]
                }
            }
        else:
            pass
        if filter_value:
            dsl['filter'] = {
                "term": { filter_field: filter_value }
            }
        lg.info("\n-------- size: %s\ndsl:\n%s", size, json.dumps(dsl,indent=4))
        result = es.search(index=self.es_index,
                           size=size,
                           doc_type=doc_type,
                           body=dsl)
        if kwargs.get("calc"):
            result = self._calc_result(result, kwargs['calc'])
        lg.debug(pp.pformat(result))
        return result
796234
def get_candidates(rules)
      candidates = []
      rules.each { |rule| candidates << rule if rule.ever_matched? && rule.time_to_report? }
      candidates
    end
504041
async def get_matches(self, force_update=False) -> list:
        
        if force_update or self.matches is None:
            res = await self.connection('GET',
                                        'tournaments/{}/matches'.format(self._id),
                                        include_attachments=1)
            self._refresh_matches_from_json(res)
        return self.matches or []
408534
def records(self):
        
        if self._records is None:
            self._records = RecordList(self._version, account_sid=self._solution['account_sid'], )
        return self._records
1209977
def values_list(
        self, *fields_: str, flat: bool = False
    ) -> "ValuesListQuery":  # pylint: disable=W0621
        
        return ValuesListQuery(
            db=self._db,
            model=self.model,
            q_objects=self._q_objects,
            flat=flat,
            fields_for_select_list=fields_,
            distinct=self._distinct,
            limit=self._limit,
            offset=self._offset,
            orderings=self._orderings,
            annotations=self._annotations,
            custom_filters=self._custom_filters,
        )
340288
public Collection<Record> findCandidateMatches(Record record) {
    if (DEBUG)
      System.out.println("---------------------------------------------------------------------------");
    
    // do lookup on all tokens from all lookup properties
    // (we only identify the buckets for now. later we decide how to process
    // them)
    List<Bucket> buckets = lookup(record);
    
    // preprocess the list of buckets
    Collections.sort(buckets);
    double score_sum = 0.0;
    for (Bucket b : buckets)
      score_sum += b.getScore();
      
    double score_so_far = 0.0;
    int threshold = buckets.size() - 1;
    for (; (score_so_far / score_sum) < min_relevance; threshold--) {
      score_so_far += buckets.get(threshold).getScore();
      if (DEBUG)
        System.out.println("score_so_far: " + (score_so_far/score_sum) + " (" +
                           threshold + ")");
    }
    // bucket.get(threshold) made us go over the limit, so we need to step
    // one back
    threshold++;
    if (DEBUG)
      System.out.println("Threshold: " + threshold);
    
    // the collection of candidates
    Map<Long, Score> candidates = new HashMap();

    // go through the buckets that we're going to collect candidates from
    int next_bucket = collectCandidates(candidates, buckets, threshold);

    // there might still be some buckets left below the threshold. for
    // these we go through the existing candidates and check if we can
    // find them in the buckets.
    bumpScores(candidates, buckets, next_bucket);

    if (DEBUG)
      System.out.println("candidates: " + candidates.size());
    
    // if the cutoff properties are not set we can stop right here
    // FIXME: it's possible to make this a lot cleaner
    if (max_search_hits > candidates.size() && min_relevance == 0.0) {
      Collection<Record> cands = new ArrayList(candidates.size());
      for (Long id : candidates.keySet())
        cands.add(store.findRecordById(id));
      if (DEBUG)
        System.out.println("final: " + cands.size());
      return cands;
    }
    
    // flatten candidates into an array, prior to sorting etc
    int ix = 0;
    Score[] scores = new Score[candidates.size()];
    double max_score = 0.0;
    for (Score s : candidates.values()) {
      scores[ix++] = s;
      if (s.score > max_score)
        max_score = s.score;
      if (DEBUG && false)
        System.out.println("" + s.id + ": " + s.score);
    }

    // allow map to be GC-ed
    candidates = null;

    // filter candidates with min_relevance and max_search_hits. do
    // this by turning the scores[] array into a priority queue (on
    // .score), then retrieving the best candidates. (gives a big
    // performance improvement over sorting the array.)
    PriorityQueue pq = new PriorityQueue(scores);
    int count = Math.min(scores.length, max_search_hits);
    Collection<Record> records = new ArrayList(count);
    for (ix = 0; ix < count; ix++) {
      Score s = pq.next();
      if (s.score >= min_relevance)
        records.add(store.findRecordById(s.id));
    }

    if (DEBUG)
      System.out.println("final: " + records.size());
    return records;
  }
1177928
def find(fn, record):
    
    values_result = fn(record.values())
    keys_result = [k for k, v in record.items() if v == values_result]
    return {keys_result[0]: values_result}
539473
function (criteria) {
            var identity = this.identity;

            return this.findOne(criteria).then(function (record) {
                if (!record) {
                    throw new Errors.NotFoundError(
                        'Could not find %s with criteria %j.'.format(
                            pluralize.singular(identity),
                            criteria
                        ), {
                            criteria: criteria,
                            collection: identity
                        });
                }

                return record;
            });
        }
166984
def filterMapAttrs(records=getIndex(), **tags):
    """"""
    if len(tags) == 0: return records # otherwise if unspecified, all given records match
    ret = []
    for record in records: # attempt to match attributes
        if matchRecordAttrs(record, tags):
            ret.append(record)
    return ret
985371
def get_applicable_values(self):
        """"""
        return [v for v in self._values if v.is_active and not v.is_all_results]