/** * <p>Create an Elasticsearch query for the given GeoRocket query part.</p> * <p>Heads up: implementors may use the helper methods from * {@link ElasticsearchQueryHelper} to build the query.</p> * @param queryPart the GeoRocket query part * @return the Elasticsearch query (may be null) * @since 1.1.0 */ default JsonObject compileQuery(QueryPart queryPart) { if (queryPart instanceof StringQueryPart) { return compileQuery(((StringQueryPart)queryPart).getSearchString()); } return null; } }
/** * Get the priority with which the Elasticsearch query returned by * {@link #compileQuery(QueryPart)} should be applied for the given * GeoRocket query part * @param queryPart the GeoRocket query part * @return the priority * @since 1.1.0 */ default MatchPriority getQueryPriority(QueryPart queryPart) { if (queryPart instanceof StringQueryPart) { return getQueryPriority(((StringQueryPart)queryPart).getSearchString()); } return MatchPriority.NONE; }
JsonObject bqb = boolQuery(1); for (QueryCompiler f : queryCompilers) { MatchPriority mp = f.getQueryPriority(str); if (mp == null) { continue; return f.compileQuery(str); case SHOULD: boolAddShould(bqb, f.compileQuery(str)); break; case MUST: boolAddMust(bqb, f.compileQuery(str)); break; case NONE: