Returns an array of relationships to include. Per JSON specification, they will
be in a comma-separated pattern.
@public
@memberOf {RelationshipUtils}
@param {Object} query
@return {Array}
773611
function getIncludesArray (query) {
  var relationships = query.include.split(',')

  return relationships.map(function (val) {
    return val.trim()
  })
}
486671
function(query) {
        var self = this;
        return Q.ninvoke(fs, 'readdir', path.join(this.backend.options.path, this.name))
            .then(function(files) {
                return Q.all(files.map(function(f) {
                    return self.get(f);
                }));
            })
            .then(function(vals) {
                return _.query(vals, query);
            });
    }
301822
function spaceSeparatedList(query, node, info) {
  var val

  if (!has(node, info.property)) {
    return false
  }

  val = node.properties[info.property]

  /* If this is a comma-separated list, and the query is contained in it,
   * return true. */
  if (
    typeof val === 'object' &&
    !info.commaSeparated &&
    val.indexOf(query.value) !== -1
  ) {
    return true
  }

  /* For all other values (including comma-separated lists),
   * return whether this is an exact match. */
  return normalizeValue(val, info) === query.value
}
445180
function formatQuery (query) {
  return Object.keys(query).sort().map(key => {
    var val = query[key]
    if (val == null) {
      return ''
    }
    if (Array.isArray(val)) {
      return val.slice().map(val2 => [key, '=', val2].join('')).join('&')
    }
    return key + '=' + val
  }).filter(Boolean).join('&')
}
1022858
function (query) {
        var fieldList = ['name', 'owner', 'description', 'keyword'];
        var parsedField = _.find(fieldList, function (field) {
          return query.indexOf(field + ':') === 0;
        });
        var parsedQuery = parsedField ? query.replace(new RegExp('^' + parsedField + ':'), '') : query;
        return {query: parsedQuery, field: parsedField};
      }
401146
function(queries) {
        var queryJSON = _.map(queries, function(q) {
          return q.toJSON().where;
        });

        this._where.$and = queryJSON;
        return this;
      }
1347314
function collectionLookup (collection, query) {
	const id = createID(query.pattern, query.language);
	log(`collectionLookup: querying for ${id}`);
	return collection.find({_id: id}, {result: 1}).toArray()
		.then(
			(docs) => {
				log(`collectionLookup: Got ${docs.length} docs`);
				if (docs.length === 0) {
					log(`collectionLookup ${createID(query.pattern, query.language)}: no results`);
					return Promise.resolve(PATTERN_UNKNOWN);
				} else if (docs.length === 1) {
					log(`collectionLookup ${query.pattern}-${query.language}: result: ${docs[0].result}`);
					return Promise.resolve(docs[0]);
				} else {
					log(`collectionLookup unexpected multiple match: ${jsonStringify(docs)}`);
					return Promise.resolve(PATTERN_UNKNOWN);
				}
			},
			(e) => {
				log(`collectionLookup error: ${e}`);
				return Promise.resolve(PATTERN_UNKNOWN);
			}
		);
}
63407
function (query, items) {
            var sortExpressions = query.query.sort,
                self = this;

            if(sortExpressions){
                return items.sort(function (a, b) {
                    var sortExpression,
                        ret = 0;
                    for (var i = 0; i < sortExpressions.length; i++) {
                        sortExpression = sortExpressions[i];
                        ret = self._compareExpression(a, b, sortExpression);
                        if (ret !== 0) {
                            return ret;
                        }
                    }
                    return ret;
                });
            } else {
                return items;
            }

        }
1094913
function querySearch (query) {
      var results = query ? self.vegetables.filter(createFilterFor(query)) : [];
      return results;
    }
122682
function query(element, elementQuery) {
  if (!element.content) {
    return [];
  }

  if (!lodash.isArray(element.content)) {
    return [];
  }

  const results = lodash.where(element.content, elementQuery);

  return lodash
    .chain(element.content)
    .map((nestedElement) => {
      return query(nestedElement, elementQuery);
    })
    .flatten()
    .concat(results)
    .value();
}
1158157
function() {
    var query = new nodes.Query
      , expr
      , pred
      , id;

    // hash values support
    if ('ident' == this.peek().type
      && ('.' == this.lookahead(2).type
      || '[' == this.lookahead(2).type)) {
      this.cond = true;
      expr = this.expression();
      this.cond = false;
      query.push(new nodes.Feature(expr.nodes));
      return query;
    }

    if (pred = this.accept('ident') || this.accept('not')) {
      pred = new nodes.Literal(pred.val.string || pred.val);

      this.skipSpacesAndComments();
      if (id = this.accept('ident')) {
        query.type = id.val;
        query.predicate = pred;
      } else {
        query.type = pred;
      }
      this.skipSpacesAndComments();

      if (!this.accept('&&')) return query;
    }

    do {
      query.push(this.feature());
    } while (this.accept('&&'));

    return query;
  }
503216
function query (query, params) {
        let rows = [];
        let stmt = sql.prepare(query);
        params = normalizeParams(params);
        stmt.bind(params);
        while(stmt.step()) {
            rows.push(stmt.getAsObject());
        }
        stmt.free();
        return rows;
    }
291184
public static function addRelationship($query, $relationship)
    {
        $property = $query->getRepository()->getDescription()->getProperty($relationship);

        switch (true) {
            case $property->isManyToOne() :
                return self::_parseManyToOne($query, $property);
            case $property->isManyToMany() :
                return self::_parseManyToMany($query, $property);
            case $property->isOneToMany() :
                return self::_parseOneToMany($query, $property);

        }
    }
221943
function querystring(query) {
  var parser = /([^=?&]+)=?([^&]*)/g
    , result = {}
    , part;

  while (part = parser.exec(query)) {
    var key = decode(part[1])
      , value = decode(part[2]);

    //
    // Prevent overriding of existing properties. This ensures that build-in
    // methods like `toString` or __proto__ are not overriden by malicious
    // querystrings.
    //
    if (key in result) continue;
    result[key] = value;
  }

  return result;
}
188714
function sortQueryresults(matches, order) {
  const orderArray = order.split(',').map(k => {
    let dir = 'asc';
    let key = k;

    if (k.charAt(0) === '-') {
      key = k.substring(1);
      dir = 'desc';
    }

    return [item => deserializeQueryParam(item[key]), dir];
  });

  const keys = orderArray.map(_.first);
  const orders = orderArray.map(_.last);

  return _.orderBy(matches, keys, orders);
}
1123453
def parse_query(qs, d = nil)
      params = {}

      (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
        k, v = p.split('=', 2).map { |x| unescape(x) }

        if cur = params[k]
          if cur.class == Array
            params[k] << v
          else
            params[k] = [cur, v]
          end
        else
          params[k] = v
        end
      end

      return params
    end
874100
function parseQueryString(query) {
  if (!query) {
    return {};
  }
  return (/^[?#]/.test(query) ? query.slice(1) : query)
      .split('&')
      .reduce((params, param) => {
        const item = param.split('=');
        const key = decodeURIComponent(item[0] || '');
        const value = decodeURIComponent(item[1] || '');
        if (key) {
          params[key] = value;
        }
        return params;
      }, {});
}