Return fields that match searches.

    Parameters
    ----------
    fields : iterable
    searches : iterable
    ignore_case, wholename, complement : boolean
196276
def match_fields(fields, searches,
                 ignore_case=False, wholename=False, complement=False):
    
    if ignore_case:
        fields = [f.lower() for f in fields]
        searches = [s.lower() for s in searches]
    if wholename:
        match_found = _complete_match
    else:
        match_found = _partial_match

    fields = [(i, field) for i, field in enumerate(fields)]
    matched = []
    for search, (idx, field) in itertools.product(searches, fields):
        if not search:  ## don't return all fields for ''
            continue
        if match_found(search, field) and idx not in matched:
            matched.append(idx)

    if complement:
        matched = [idx for idx in list(zip(*fields))[0] if idx not in matched]

    return matched
1167440
def unsearchable_fields(self):
        
        filter_func = lambda field: not field.is_searchable
        return filter(filter_func, self.names) + \
               filter(filter_func, self.emails) + \
               filter(filter_func, self.phones) + \
               filter(filter_func, self.usernames) + \
               filter(filter_func, self.addresses) + \
               filter(filter_func, self.dobs)
197240
def order_by(self, *field_names):
        
        if not self._search_ordered:
            self._search_ordered = len(self._search_terms) > 0
        return super(SearchableQuerySet, self).order_by(*field_names)
103720
def has_field(mc, field_name):
    
    try:
        mc._meta.get_field(field_name)
    except FieldDoesNotExist:
        return False
    return True
896711
public T findOne(T query, T fields) {
        return findOne(query, fields, getReadPreference());
    }
1063458
def get_meta_fields(self, fields, kwargs={}):
        '''
        
        '''
        fields = to_list(fields)
        meta = self.get_meta()
        return {field: meta.get(field) for field in fields}
723201
def in_field(self, field_name, *field_vals, **field_kwargs):
        
        field_name = self._normalize_field_name(field_name)
        fv = make_list(field_vals[0]) if field_vals else None
        if field_kwargs:
            for k in field_kwargs:
                if not field_kwargs[k]:
                    raise ValueError("Cannot IN an empty list")

                field_kwargs[k] = make_list(field_kwargs[k])

        else:
            if not fv: self.can_get = False

        self.fields_where.append(field_name, ["in", field_name, fv, field_kwargs])
        return self
449204
def help_completion_fields(self):
        
        for name, field in sorted(engine.FieldDefinition.FIELDS.items()):
            if issubclass(field._matcher, matching.BoolFilter):
                yield "%s=no" % (name,)
                yield "%s=yes" % (name,)
                continue
            elif issubclass(field._matcher, matching.PatternFilter):
                yield "%s=" % (name,)
                yield "%s=/" % (name,)
                yield "%s=?" % (name,)
                yield "%s=\"'*'\"" % (name,)
                continue
            elif issubclass(field._matcher, matching.NumericFilterBase):
                for i in range(10):
                    yield "%s=%d" % (name, i)
            else:
                yield "%s=" % (name,)

            yield r"%s=+" % (name,)
            yield r"%s=-" % (name,)

        yield "custom_"
        yield "kind_"
206696
function () {
        var searchField = this.config.searchField;
        return searchField &&
          Object.keys(searchField).every(function (key) {
            return searchField[key] === false;
          });
      }
864412
def get_field_list(fields, schema):
  
  # If the fields weren't supplied get them from the schema.
  if schema:
    all_fields = [f['name'] for f in schema._bq_schema if f['type'] != 'RECORD']

  if isinstance(fields, list):
    if schema:
      # validate fields exist
      for f in fields:
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
    return fields
  if isinstance(fields, basestring) and fields != '*':
    if schema:
      # validate fields exist
      for f in fields.split(','):
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
      return fields.split(',')
  if not schema:
    return []
  return all_fields
722628
def QueryFields(r, what, fields=None):
    

    query = {}

    if fields is not None:
        query["fields"] = ",".join(fields)

    return r.request("get", "/2/query/%s/fields" % what, query=query)
20573
def form_query(query_type, query):
    
    fields = [
        field + "^" + str(SEARCH_BOOSTS[field]) if field in SEARCH_BOOSTS else field
        for field in SEARCH_FIELDS
    ]
    return Q("multi_match", fields=fields, query=query, type=query_type)
153698
def get_fields_for_keyword(self, keyword, mode='a'):
        """"""
        field = self.keyword_to_fields.get(keyword, keyword)
        if isinstance(field, dict):
            return field[mode]
        elif isinstance(field, (list, tuple)):
            return field
        return [field]
686591
def scan_for_field(self, field_key):
        '''
        
        '''
        if field_key == self.get_name():
            return self
        if field_key in self._fields_dict:
            return self._fields_dict[field_key]
        for field in self._fields:
            if isinstance(field, Container):
                resolved = field.scan_for_field(field_key)
                if resolved:
                    return resolved
        return None
1203738
def try_fields(cls, *names) -> t.Optional[t.Any]:
        """"""
        for name in names:
            if hasattr(cls, name):
                return getattr(cls, name)
        raise AttributeError((cls, names))
345579
def match(self, row):
        
        if row[self._field] in self._values:
            return True

        for condition in self._conditions:
            if condition.match(row):
                return True

        return False
969071
def where(self, fieldname, value, negate=False):
        
        if negate:
            return self.mask([elem != value
                              for elem in self[fieldname]])
        else:
            return self.mask([elem == value
                              for elem in self[fieldname]])