Combines the given stream ID and query string into a single filter string.

@param streamId the stream ID
@param query    the query string (might be null or empty)
@return the combined filter string
969525
protected String buildQueryFilter(String streamId, String query) {
        checkArgument(streamId != null, "streamId parameter cannot be null");

        final String trimmedStreamId = streamId.trim();

        checkArgument(!trimmedStreamId.isEmpty(), "streamId parameter cannot be empty");

        final StringBuilder builder = new StringBuilder().append("streams:").append(trimmedStreamId);

        if (query != null) {
            final String trimmedQuery = query.trim();
            if (!trimmedQuery.isEmpty() && !"*".equals(trimmedQuery)) {
                builder.append(" AND (").append(trimmedQuery).append(")");
            }
        }

        return builder.toString();
    }
686505
@Override
	public List<ScopDescription> filterByDescription(String query) throws ScopIOException {
		try {
			ensureDesInstalled();
		} catch (IOException e) {
			throw new ScopIOException(e);
		}

		query = query.toLowerCase();
		List<ScopDescription> matches = new ArrayList<ScopDescription>();
		for (Integer i : sunidMap.keySet()){
			ScopDescription sc = sunidMap.get(i);

			if( sc.getDescription().toLowerCase().startsWith(query)){
				matches.add(sc);
			}
		}

		return matches;
	}
1044232
public <T> QueryCriteria addParameter( String listId, T... param ) {
        if( param.length == 0 ) {
            return null;
        }
        if( QueryCriteriaType.REGEXP.equals(this.type) && ! (param[0] instanceof String) ) {
            throw new IllegalArgumentException("Only String parameters may be used in regular expressions.");
        }
        QueryCriteria criteria =  new QueryCriteria(listId, this.union, this.type, param.length);
        for( T paramElem : param ) {
           criteria.addParameter(paramElem);
        }
        addCriteria(criteria);
        return criteria;
    }
902327
public static Call.Mapper<List<List<Span>>, List<List<Span>>> filterTraces(QueryRequest request) {
    return new FilterTracesIfClashOnLowerTraceId(request);
  }
85444
protected IndexQuery generateIndexQuery(String query) {
        IndexQuery indexQuery = new IndexQuery();
        indexQuery.setQuery(query);
        indexQuery.setStart(start);
        indexQuery.setWaitForNonStaleResults(theWaitForNonStaleResults);
        indexQuery.setWaitForNonStaleResultsTimeout(timeout);
        indexQuery.setQueryParameters(queryParameters);
        indexQuery.setDisableCaching(disableCaching);

        if (pageSize != null) {
            indexQuery.setPageSize(pageSize);
        }
        return indexQuery;
    }
230468
public R textQueryString(String query, TextQueryString options) {
    peekExprList().textQueryString(query, options);
    return root;
  }
106302
public static Map<String, String> parseQuery(String query) {
		Map<String, String> result = new LinkedHashMap<String, String>();
		
		if (query != null) {
			for (String keyValue: query.split("&")) {
				String[] pair = keyValue.split("=");
				result.put(StringUtils.urlDecode(pair[0]), StringUtils.urlDecode(pair[1]));
			}
		}
		
		return result;
	}
791577
public static <T> QueryPlus<T> wrap(Query<T> query)
  {
    Preconditions.checkNotNull(query);
    return new QueryPlus<>(query, null, null);
  }
203946
protected void addFilterQueryParts(CmsSolrQuery query) {

        if (!m_state.getCheckedEntries().isEmpty()) {
            StringBuffer value = new StringBuffer();
            value.append("{!tag=").append(m_config.getName()).append('}');
            value.append(m_config.getField());
            value.append(":(");
            final Iterator<String> fieldIterator = m_state.getCheckedEntries().iterator();
            value.append(m_config.modifyFilterQuery(fieldIterator.next()));
            final String concater = m_config.getIsAndFacet() ? " AND " : " OR ";
            while (fieldIterator.hasNext()) {
                value.append(concater);
                value.append(m_config.modifyFilterQuery(fieldIterator.next()));
            }
            value.append(')');
            query.add("fq", value.toString());
        }
    }
986111
@NotNull
    protected final JpaStream findStream(@NotNull final StreamId streamId) {

        Contract.requireArgNotNull("streamId", streamId);
        verifyStreamEntityExists(streamId);

        final String sql = createJpqlStreamSelect(streamId);
        final TypedQuery<JpaStream> query = getEm().createQuery(sql, JpaStream.class);
        setJpqlParameters(query, streamId);
        final List<JpaStream> streams = query.getResultList();
        if (streams.size() == 0) {
            throw new StreamNotFoundException(streamId);
        }
        final JpaStream stream = streams.get(0);
        if (stream.getState() == StreamState.SOFT_DELETED) {
            // TODO Remove after event store has a way to distinguish between
            // never-existing and soft deleted
            // streams
            throw new StreamNotFoundException(streamId);
        }
        return stream;

    }
125904
public static Stream<Element> stream(Query... queries) {
        return Arrays.stream(queries)
            .map(query -> StreamSupport.stream(query.elements().spliterator(), false))
            .reduce(Stream::concat)
            .orElseGet(Stream::empty);
    }
1297008
public static String serializeServiceInstanceQuery(ServiceInstanceQuery query){
        List<QueryCriterion> criteria = query.getCriteria();
        StringBuilder sb = new StringBuilder();
        for(QueryCriterion criterion : criteria){
            String statement = serialize(criterion);
            if(statement != null && ! statement.isEmpty()){
                sb.append(statement).append(";");
            }
        }
        return sb.toString();
    }
205818
private void mergeQueryParams(Map<String, String[]> urlParams) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "mergeQueryParams: " + urlParams);
        }
        for (Entry<String, String[]> entry : urlParams.entrySet()) {
            String key = entry.getKey();
            // prepend to postdata values if necessary
            String[] post = this.queryParameters.get(key);
            String[] url = entry.getValue();
            if (null != post) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "map already contains key " + key);
                }
                String[] newVals = new String[post.length + url.length];
                System.arraycopy(url, 0, newVals, 0, url.length);
                System.arraycopy(post, 0, newVals, url.length, post.length);
                this.queryParameters.put(key, newVals);
            } else {
                this.queryParameters.put(key, url);
            }
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "put key " + key + " into map.");
            }
        }
    }
1244979
public Stream<T> filter(Predicate<? super T> predicate) {
        List<T> reduction = new ArrayList<T>();
        while (iterator.hasNext()) {
            final T element = iterator.next();
            if (predicate.test(element)) {
                reduction.add(element);
            }
        }
        return Stream.of(reduction);
    }
991772
public ArrayList<OvhStreamRule> serviceName_output_graylog_stream_streamId_rule_ruleId_GET(String serviceName, String streamId, String ruleId) throws IOException {
		String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule/{ruleId}";
		StringBuilder sb = path(qPath, serviceName, streamId, ruleId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t6);
	}
981244
@SuppressWarnings("deprecation")
	public static Map<String, List<String>> convert(WebQuery query)
	{
		MultivaluedHashMap<String, String> map = new MultivaluedHashMap<>();

		map.putSingle(WQUriControlField.FETCH.getName(), query.fetch);

		if (query.dbfetch != null)
			map.putSingle(WQUriControlField.DBFETCH.getName(), query.dbfetch);

		if (query.expand != null)
			map.put(WQUriControlField.EXPAND.getName(), list(query.expand));

		map.put(WQUriControlField.ORDER.getName(),
		        query.orderings.stream().map(WQOrder:: toLegacyForm).collect(Collectors.toList()));

		if (query.getOffset() > 0)
			map.putSingle(WQUriControlField.OFFSET.getName(), String.valueOf(query.getOffset()));

		map.putSingle(WQUriControlField.LIMIT.getName(), String.valueOf(query.getLimit()));

		if (query.constraints.computeSize)
			map.putSingle(WQUriControlField.COMPUTE_SIZE.getName(), String.valueOf(query.constraints.computeSize));
		if (query.constraints.subclass != null)
			map.put(WQUriControlField.CLASS.getName(), list(query.constraints.subclass));

		addConstraints(map, query.constraints);

		return map;
	}
1290479
public static Map<String, String> queryToParams(String query) throws UnsupportedEncodingException {
		Map<String, String> query_pairs = new HashMap<String, String>();
		String[] pairs = query.split("&");
		for (String pair : pairs) {
			int idx = pair.indexOf("=");
			query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"),
					URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
		}
		return query_pairs;
	}