{@inheritDoc}

@throws IllegalArgumentException if filter.query has nested objects
177365
@Override
    public List<T> readWithFilter(ReadFilter filter) {
        if (filter == null) {
            filter = new ReadFilter();
        }
        JSONObject where = filter.getWhere();
        scanForNestedObjectsInWhereClause(where);
        List<T> results = new ArrayList<T>(data.values());

        filterData(results, where);
        results = pageData(results, filter.getLimit(), filter.getOffset());
        return results;
    }
624013
public function find($key, $filter = null) {
		if (!$this->has($key)) {
			return [];
		}
		
		$annotations = [];
		
		foreach ($this->names[$key] as $index) {
			if (!is_int($filter)) {
				$annotations[] = $this->annotations[$index];
				continue;
			}
			
			$annotation = $this->annotations[$index];
			$flags = 0;
			
			//match value type
			if ($filter & Filter::TYPE_ALL) {
				$value = $annotation->getValue();
				if (is_null($value)) {
					$flags |= Filter::TYPE_NULL;
				}
				elseif (is_string($value)) {
					$flags |= Filter::TYPE_STRING;
				}
				elseif (is_int($value)) {
					$flags |= Filter::TYPE_INTEGER;
				}
				elseif (is_float($value)) {
					$flags |= Filter::TYPE_FLOAT;
				}
				elseif (is_bool($value)) {
					$flags |= Filter::TYPE_BOOLEAN;
				}
				elseif (is_array($value)) {
					$flags |= Filter::TYPE_ARRAY;
				}
				elseif (id_object($value)) {
					$flags |= Filter::TYPE_OBJECT;
				}
			}
			
			//match argument filter
			if ($filter & Filter::HAS_ARGUMENT || $filter & Filter::NOT_HAS_ARGUMENT) {
				if ($annotation->getArgument()) {
					$flags |= Filter::HAS_ARGUMENT;
				}
				else {
					$flags |= Filter::NOT_HAS_ARGUMENT;
				}
			}
			
			//add annotation if it meets all requirements
			if (($flags & $filter) == $flags) {
				$annotations[] = $annotation;
			}
		}
		
		return $annotations;
	}
638302
function(item1, item2, query) {
            if (typeof item1 === 'object' && typeof item2 === 'object') {
                query = query || {};
                for (var prop in query) {
                    if (item1[prop] !== item2[prop])
                        return false;
                }
                return true;
            }
            return item1 === item2;
        }
1257596
private QueryBuilder nestedQueryBuilder(
      List<Attribute> attributePath, QueryBuilder queryBuilder) {
    if (attributePath.size() == 1) {
      return queryBuilder;
    } else if (attributePath.size() == 2) {
      return QueryBuilders.nestedQuery(
          getQueryFieldName(attributePath.get(0)), queryBuilder, ScoreMode.Avg);
    } else {
      throw new UnsupportedOperationException(CANNOT_FILTER_DEEP_REFERENCE_MSG);
    }
  }
401219
@Override
	public boolean filter(Object entity) {
		for (Filter filter : filters) {
			if (filter.filter(entity)) {
				return true;
			}
		}

		return false;
	}
1136616
@Override
	public <T> Optional<T> queryForObject(String collection, Query query, Class<T> clazz, RequestMethod method) {

		Assert.notNull(collection, "Collection must not be null!");
		Assert.notNull(query, "Query must not be 'null'.");
		Assert.notNull(clazz, "Target class must not be 'null'.");

		query.setPageRequest(PageRequest.of(0, 1));
		QueryResponse response = querySolr(collection, query, clazz, method);

		if (response.getResults().size() > 0) {
			if (response.getResults().size() > 1) {
				LOGGER.warn("More than 1 result found for singe result query ('{}'), returning first entry in list", query);
			}
			return Optional.ofNullable(convertSolrDocumentListToBeans(response.getResults(), clazz).get(0));
		}
		return Optional.empty();
	}
987279
function (query, items) {
            var expression = query.query.where,
                ret = [];

            for (var i = 0; i < items.length; i++) {
                if (this._filterItem(items[i], expression)) {
                    ret.push(items[i]);
                }
            }

            return ret;

        }
234071
private function applyNestedFilter(Builder $query, array $fields, $operator, $value, $or = false)
    {
        $relation_name = implode('.', array_slice($fields, 0, count($fields) - 1));
        $relation_field = end($fields);
        if ($relation_name[0] == '!') {
            $relation_name = substr($relation_name, 1, strlen($relation_name));

            $that = $this;

            return $query->whereHas($relation_name, function ($query) use ($relation_field, $operator, $value, $that, $or) {
                $query = $that->applyWhereClause($query, $relation_field, $operator, $value, $or);
            }, '=', 0);
        }

        $that = $this;

        return $query->whereHas($relation_name, function ($query) use ($relation_field, $operator, $value, $that, $or) {
            $query = $that->applyWhereClause($query, $relation_field, $operator, $value, $or);
        });
    }
16772
function(query){

                if(query.filter) {
                    var clone = canReflect.serialize(query);
                    var filter = query.filter;
                    clone.filter = {};
                    clone.filter[prop] = filter;
                    return clone;
                } else {
                    return query;
                }
            }
216468
@Bind(aggregate = true, optional = true)
    public void bindFilter(Filter filter) {
        filters.add(filter);
    }
1330366
public function nestedQuery($fieldName, QueryScaffolder $queryScaffolder = null)
    {
        $query = isset($this->nestedQueries[$fieldName]) ? $this->nestedQueries[$fieldName] : null;

        if ($query) {
            return $query;
        }

        if (!$queryScaffolder) {
            // If no scaffolder if provided, try to infer the type by resolving the field
            $result = $this->getDataObjectInstance()->obj($fieldName);

            if (!$result instanceof DataList && !$result instanceof ArrayList) {
                throw new InvalidArgumentException(
                    sprintf(
                        '%s::addNestedQuery() tried to add %s, but must be passed a method name or relation that returns a DataList or ArrayList',
                        __CLASS__,
                        $fieldName
                    )
                );
            }

            $queryScaffolder = new ListQueryScaffolder(
                $fieldName,
                null,
                function ($obj) use ($fieldName) {
                    /* @var DataObject $obj */
                    return $obj->obj($fieldName);
                },
                $result->dataClass()
            );
        }

        $queryScaffolder->setChainableParent($this);
        $queryScaffolder->setNested(true);
        $this->nestedQueries[$fieldName] = $queryScaffolder;

        return $queryScaffolder;
    }
458472
private void setInnerPredicate(Predicate<K, V> predicate) {
        if (predicate instanceof PagingPredicate) {
            throw new IllegalArgumentException("Nested PagingPredicate is not supported!");
        }
        this.predicate = predicate;
    }
422115
function normFilter(model, filter, fieldName) {
  if (!filter) return null;

  let result = {},
    fields = model.def.fields;
  for (const key in filter) {
    if (key === '$and' || key === '$or') { // {$and:[]}, {$or: []}
      const subfilters = [];
      for (const j in filter[key]) {
        const sub = normFilter(model, filter[key][j]);
        if (!sub) continue;
        subfilters.push(sub);
      }
      if (subfilters.length > 0) result[key] = subfilters;
      continue;
    }
    if (key.charAt(0) === '$') { // key is an operator, {op: value}
      if (!fieldName) {
        throw new QueryError(model.name, 'no field for operator %s in filter', key);
      }
      if (!fields[fieldName]) {
        throw new QueryError(model.name, 'nonexistent field %s in filter', fieldName);
      }
      result[key] = fields[fieldName].normalize(filter[key], { query: true });
      continue;
    }

    // key is a field, {field: value}, {field: {op: value, ...}}
    fieldName = key;
    const field = fields[key];
    if (!field) throw new QueryError(model.name, 'nonexistent field %s in filter', key);
    if (field.props.filterRedirect) {
      const proxyFields = field.props.filterRedirect.replace(/\s+/g, '').split(',');
      const proxyFilter = { $or: [] };
      for (const pi in proxyFields) {
        const proxyFieldName = proxyFields[pi];
        const fieldProxyFilter = {};
        fieldProxyFilter[proxyFieldName] = filter[key];
        proxyFilter.$or.push(fieldProxyFilter);
      }
      Object.assign(result, normFilter(model, proxyFilter));
      continue;
    }

    // {field: {op: value, ...}}
    if (util.isPlainObject(filter[key])) {
      result[fieldName] = normFilter(model, filter[key], fieldName);
      continue;
    }

    // {field: value}, value is not string
    let value = filter[key];
    if (typeof value !== 'string') { // array, date, int, float, bool, etc
      result[fieldName] = field.normalize(value, { query: true });
      continue;
    }

    // {field: value}, value is a plain string
    value = value.trim();
    if (!(value.substring(0, 1) === '{' && value.substr(-1) === '}')) {
      result[fieldName] = field.normalize(value, { query: true });
      continue;
    }

    // {field: value}, value is string and may contain a json object which is a query filter too
    const jsonExpr = null;
    try {
      eval('jsonExpr = '+value);//eslint-disable-line
    } catch (e) {}// eslint-disable-line no-empty
    if (!jsonExpr) { // parse fails, treat as plain string
      result[fieldName] = field.normalize(value, { query: true });
    } else {
      const jsonFilter = {};
      for (const jk in jsonExpr) {
        if (jk.charAt(0) === '$') { // expand {op:val} to {field:{op: val}}
          jsonFilter[fieldName] = {};
          jsonFilter[fieldName][jk] = jsonExpr[jk];
        } else { // {field: value}
          jsonFilter[jk] = jsonExpr[jk];
        }
      }
      result = Object.assign(result, normFilter(model, jsonFilter, fieldName));
    }
  }

  if (util.isEmptyObject(result)) return null;
  return result;
}
1280118
function filter (resources, req) {
  util.debug("There are %d resources in %s", resources.length, req.path);

  if (resources.length > 0) {
    // If there are query params, then filter the collection by them
    let queryParams = _.filter(req.swagger.params, { in: "query" });
    if (queryParams.length > 0) {
      // Build the filter object
      let filterCriteria = { data: {}};
      queryParams.forEach((param) => {
        if (req.query[param.name] !== undefined) {
          setDeepProperty(filterCriteria.data, param.name, req.query[param.name]);
        }
      });

      if (!_.isEmpty(filterCriteria.data)) {
        // Filter the collection
        util.debug("Filtering resources by %j", filterCriteria.data);
        resources = _.filter(resources, filterCriteria);
        util.debug("%d resources matched the filter criteria", resources.length);
      }
    }
  }

  return resources;
}
1339836
function queryFilter(where) {
  if (where.$or) {
    return object =>
      _.reduce(where.$or, (result, subclause) => result ||
        queryFilter(subclause)(object), false);
  }

  // Go through each key in where clause
  return object => _.reduce(where, (result, whereParams, key) => {
    const match = evaluateObject(object, whereParams, key);
    return result && match;
  }, true);
}
124266
public MongoDeepJobConfig<T> filterQuery(Filter[] filters) {

        if (filters.length > 0) {
            List<BasicDBObject> list = new ArrayList<>();

            QueryBuilder queryBuilder = QueryBuilder.start();
            for (int i = 0; i < filters.length; i++) {
                BasicDBObject bsonObject = new BasicDBObject();

                Filter filter = filters[i];
                if (filter.getFilterType().equals(FilterType.EQ)) {
                    bsonObject.put(filter.getField(), filter.getValue());
                } else {
                    bsonObject.put(filter.getField(),
                            new BasicDBObject("$".concat(filter.getFilterType().getFilterTypeId().toLowerCase()),
                                    filter.getValue()));
                }

                list.add(bsonObject);
            }
            queryBuilder.and(list.toArray(new BasicDBObject[list.size()]));

            filterQuery(queryBuilder);
        }
        return this;

    }
1212207
public void setNestedFilters(java.util.Collection<NestedFilters> nestedFilters) {
        if (nestedFilters == null) {
            this.nestedFilters = null;
            return;
        }

        this.nestedFilters = new java.util.ArrayList<NestedFilters>(nestedFilters);
    }