- /**
- * All queries in this list must evaluate to true for the filter to pass.
- */
- private QueryStatement[] all;
-
- /**
- * Any one of the queries in this list must evaluate to true for the
- * filter to pass.
- */
- private QueryStatement[] any;
-
-
- public QueryStatement[] getAll() {
- return all;
- }
-
- public void setAll(QueryStatement[] all) {
- this.all = all;
- }
-
- public QueryStatement[] getAny() {
- return any;
- }
-
- public void setAny(QueryStatement[] any) {
- this.any = any;
- }
-
- /**
- * This method returns a string which represents this filter in syntax
- * that is understandable by ElasticSearch and is suitable for inclusion
- * in an ElasticSearch query string.
- *
- * @return - ElasticSearch syntax string.
- */
- public String toElasticSearch() {
-
- StringBuilder sb = new StringBuilder();
-
- List<QueryStatement> notMatchQueries = new ArrayList<QueryStatement>();
- sb.append("{");
- sb.append("\"bool\": {");
-
- // Add the queries from our 'all' list.
- int matchQueriesCount = 0;
- int notMatchQueriesCount = 0;
- if (all != null) {
- sb.append("\"must\": [");
-
- for (QueryStatement query : all) {
- if (matchQueriesCount > 0) {
- sb.append(", ");
- }