Lines Matching defs:query

39  * Helper class that builds a Lucene query based on provided search terms for
49 * A map containing the query text for each field. (We use a sorted map here
50 * only because we have tests that check the generated query string. If we
58 * @param freetext query string to set
66 * @return {@code null} if not set, the query string otherwise.
74 * @param defs query string to set
82 * @return {@code null} if not set, the query string otherwise.
90 * @param refs query string to set
98 * @return {@code null} if not set, the query string otherwise.
105 * @param path query string to set
113 * @return {@code null} if not set, the query string otherwise.
121 * @param hist query string to set
129 * @return {@code null} if not set, the query string otherwise.
136 * Get a map containing the query text for each of the fields that have
145 * Get the number of query fields set.
146 * @return the current number of fields with a none-empty query string.
153 * Build a new query based on the query text that has been passed in to this
156 * @return a query, or {@code null} if no query text is available.
157 * @throws ParseException if the query text cannot be parsed
164 // Parse each of the query texts separately
171 // If we only have one sub-query, return it directly
180 // the query as a whole. One exception to this rule: If the query
187 // query with Occur.MUST.
189 for (Query query : queryList) {
190 if (query instanceof BooleanQuery) {
191 BooleanQuery boolQuery = (BooleanQuery) query;
195 combinedQuery.add(query, Occur.MUST);
202 combinedQuery.add(query, Occur.MUST);
209 * Add query text for the specified field.
211 * @param field the field to add query text for
212 * @param query the query text to set
215 private QueryBuilder addQueryText(String field, String query) {
216 if (query == null || query.isEmpty()) {
219 queries.put(field, query);
229 * Escape special characters in a query string.
231 * @param field the field for which the query string is provided
232 * @param query the query string to escape
233 * @return the escaped query string
235 private static String escapeQueryString(String field, String query) {
239 ? query.replace("::", "\\:\\:")
242 : query.replace(":", "\\:");
248 * @param field the field to build the query against
249 * @param queryText the query text
250 * @return a parsed query
251 * @throws ParseException if the query text cannot be parsed
262 * @param query the query to check
264 * @return whether or not the query contains a clause of the specified type
266 private static boolean hasClause(BooleanQuery query, Occur occur) {
267 for (BooleanClause clause : query) {