/* (non-Javadoc)
@see org.archive.wayback.ResourceIndex#query(org.archive.wayback.core.WaybackRequest)
354382
public SearchResults query(WaybackRequest wbRequest)
		throws ResourceIndexNotAvailableException,
		ResourceNotInArchiveException, BadQueryException,
		AccessControlException {
		
		RangeGroup group = getRangeGroupForRequest(wbRequest);
		return group.query(wbRequest);
	}
990766
def query(self, query):
    '''
    '''
    self.logger.info('%s: query %s' % (self, query))
    return super(LoggingDatastore, self).query(query)
738113
@Override
    public <T> T query(MonetaryQuery<T> query) {
        Objects.requireNonNull(query);
        try {
            return query.queryFrom(this);
        } catch (MonetaryException | ArithmeticException e) {
            throw e;
        } catch (Exception e) {
            throw new MonetaryException("Query failed: " + query, e);
        }
    }
237026
@Override
    public synchronized List<Map<String, ResultColumn>> query(final Expression query) throws DatabaseEngineException {
        return query(translate(query));
    }
508924
public String query(String paramName, String defaultValue) {
        return this.request.query(paramName, defaultValue);
    }
1064751
protected final List<T> findByQuery(String query, Object... params) {
        return this.dataAccess.findByQuery(query, params);
    }
1370204
public JSONObject search(Query params, RequestOptions requestOptions) throws AlgoliaException {
    String paramsString = params.getQueryString();
    JSONObject body = new JSONObject();
    try {
      body.put("params", paramsString);
    } catch (JSONException e) {
      throw new RuntimeException(e);
    }
    return client.postRequest("/1/indexes/" + encodedIndexName + "/query", body.toString(), false, true, requestOptions);
  }
1052291
public <T> List<T> search(org.beangle.commons.dao.query.Query<T> query) {
    if (query instanceof LimitQuery) {
      org.beangle.commons.dao.query.LimitQuery<T> limitQuery = (org.beangle.commons.dao.query.LimitQuery<T>) query;
      if (null == limitQuery.getLimit()) {
        return QuerySupport.find(limitQuery, getSession());
      } else {
        return new SinglePage<T>(limitQuery.getLimit().getPageIndex(), limitQuery.getLimit().getPageSize(),
            QuerySupport.count(limitQuery, getSession()), QuerySupport.find(query, getSession()));
      }
    } else {
      return QuerySupport.find(query, getSession());
    }
  }
479975
public List<T> query(String query, QueryType type)
    {
        switch (type)
        {
        case JPQL:
            return query(query);

        case NATIVE:
            return nativeQuery(query);

        default:
            throw new KunderaException("invalid query type");
        }
    }
1159071
@SuppressWarnings("rawtypes")
    public static List<Map<String, Object>> query(final Uri uri, Map<String, Class> projectionTypeMap) {
        return query(uri, projectionTypeMap, null, null, null);
    }
964676
public List findByQuery(String query, Map<Parameter, Object> parameterMap, int firstResult, int maxResult)
    {
        s = getStatelessSession();

        Query q = s.createQuery(query);
        q.setFirstResult(firstResult);
        q.setMaxResults(maxResult);

        setParameters(parameterMap, q);

        return q.list();
    }
6830
public SparqlResult runQuery(String endpoint, String query) {
    return SparqlClient.execute(endpoint, query, username, password);
  }
986917
@SuppressWarnings("unchecked")
    @Override
    public <R> R query(TemporalQuery<R> query) {
        if (query == TemporalQueries.chronology()) {
            return (R) getChronology();
        } else if (query == TemporalQueries.precision()) {
            return (R) NANOS;
        } else if (query == TemporalQueries.localDate()) {
            return (R) LocalDate.ofEpochDay(toLocalDate().toEpochDay());
        } else if (query == TemporalQueries.localTime()) {
            return (R) toLocalTime();
        } else if (query == TemporalQueries.zone() || query == TemporalQueries.zoneId() || query == TemporalQueries.offset()) {
            return null;
        }
        return super.query(query);
    }
1181155
function query(p, callback) {
		if (p.data) {
			extend(p.query, p.data);
			p.data = null;
		}

		callback(p.path);
	}
310512
public WaybackRequest parse(HttpServletRequest httpRequest,
			AccessPoint wbContext) throws BadQueryException {
		
		WaybackRequest wbRequest = null;
		String server = httpRequest.getServerName() + 
			":" + httpRequest.getServerPort();
		if(server.toLowerCase().endsWith(hostPort.toLowerCase())) {
			int length = server.length() - hostPort.length();
			if(server.length() > hostPort.length()) {
				String prefix = server.substring(0,length - 1);
				Matcher replayMatcher = REPLAY_REGEX.matcher(prefix);
				if (replayMatcher != null && replayMatcher.matches()) {
					wbRequest = new WaybackRequest();
					String dateStr = replayMatcher.group(1);
					String host = replayMatcher.group(2);

					String requestUrl = getRequestString(host,httpRequest);

					wbRequest.setReplayRequest();
					wbRequest.setReplayTimestamp(dateStr);
					wbRequest.setRequestUrl(requestUrl);

				} else {
					Matcher queryMatcher = QUERY_REGEX.matcher(prefix);
					if(queryMatcher != null && queryMatcher.matches()) {
						wbRequest = new WaybackRequest();
						String dateStr = queryMatcher.group(1);
						String host = queryMatcher.group(2);

						String requestUrl = getRequestString(host,httpRequest);

						String startDate;
						String endDate;
						if(dateStr.length() == 0) {
							startDate = getEarliestTimestamp();
							endDate = getLatestTimestamp();
						} else {
							startDate = Timestamp.parseBefore(dateStr).getDateStr();
							endDate = Timestamp.parseAfter(dateStr).getDateStr();
						}
						wbRequest.setCaptureQueryRequest();
						wbRequest.setStartTimestamp(startDate);
						wbRequest.setEndTimestamp(endDate);
						wbRequest.setRequestUrl(requestUrl);
					}
					// TODO: what if it doesn't match the QUERY_REGEX?
					//       throw a BadQueryException?
				}
			}
		}
		return wbRequest;
	}
632269
@Override
    public List<Address> search(final String query) throws IOException {

        final NominatimSearchRequest q = new NominatimSearchRequest();
        q.setQuery(query);
        return this.search(q);
    }
974830
public QueryResponse<DatastoreKey> executeKeyQueryRequest(KeyQueryRequest request) {
    try {
      GqlQuery.Builder<Key> queryBuilder = Query.newGqlQueryBuilder(ResultType.KEY,
          request.getQuery());
      queryBuilder.setNamespace(entityManager.getEffectiveNamespace());
      queryBuilder.setAllowLiteral(request.isAllowLiterals());
      QueryUtils.applyNamedBindings(queryBuilder, request.getNamedBindings());
      QueryUtils.applyPositionalBindings(queryBuilder, request.getPositionalBindings());
      GqlQuery<Key> gqlQuery = queryBuilder.build();
      QueryResults<Key> results = nativeReader.run(gqlQuery);
      List<DatastoreKey> entities = new ArrayList<>();
      DefaultQueryResponse<DatastoreKey> response = new DefaultQueryResponse<>();
      response.setStartCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      while (results.hasNext()) {
        Key result = results.next();
        DatastoreKey datastoreKey = new DefaultDatastoreKey(result);
        entities.add(datastoreKey);
      }
      response.setResults(entities);
      response.setEndCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      response.setQueryResponseMetadata(
          new DefaultQueryResponseMetadata(
              QueryResponseMetadata.QueryState.forMoreResultsType(results.getMoreResults())));
      return response;
    } catch (DatastoreException exp) {
      throw new EntityManagerException(exp);
    }
  }