Commit 3a1f523e authored by Noel Alonso's avatar Noel Alonso
Browse files

Elimina consulta contra timeseries y adapta tests

parent 25aa2deb
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -23,12 +23,9 @@ package es.redmic.es.common.queryFactory.geodata;
import java.util.HashSet;
import java.util.Set;

import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.InnerHitBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.join.query.JoinQueryBuilders;

import es.redmic.models.es.common.DataPrefixType;
import es.redmic.models.es.common.query.dto.GeoDataQueryDTO;
@@ -48,24 +45,13 @@ public abstract class InfrastructureQueryUtils extends GeoDataQueryUtils {
			QueryBuilder partialQuery) {

		BoolQueryBuilder query = getOrInitializeBaseQuery(getGeoDataQuery(queryDTO, internalQuery, partialQuery));
		BoolQueryBuilder queryOnChildren = getQueryOnChildren(queryDTO);

		addMustTermIfExist(query, getZQuery(SITE_PATH, Z_PROPERTY, queryDTO.getZ()));
		addMustTermIfExist(query, getDateLimitsQuery(queryDTO.getDateLimits(), SITE_PATH + "." + DATE_PROPERTY));

		query.should(JoinQueryBuilders
				.hasChildQuery(CHILDREN_NAME,
						queryOnChildren.hasClauses() ? queryOnChildren : QueryBuilders.matchAllQuery(), ScoreMode.Avg)
				.innerHit(new InnerHitBuilder()));

		return getResultQuery(query);
	}

	private static BoolQueryBuilder getQueryOnChildren(GeoDataQueryDTO queryDTO) {

		return QueryBuilders.boolQuery();
	}

	public static Set<String> getFieldsExcludedOnQuery() {

		HashSet<String> fieldsExcludedOnQuery = new HashSet<>();
+0 −25
Original line number Diff line number Diff line
@@ -37,31 +37,6 @@
        }
      }
    ],
    "should" : [
      {
        "has_child" : {
          "query" : {
            "match_all" : {
              "boost" : 1.0
            }
          },
          "type" : "attributeseries",
          "score_mode" : "avg",
          "min_children" : 0,
          "max_children" : 2147483647,
          "ignore_unmapped" : false,
          "boost" : 1.0,
          "inner_hits" : {
            "ignore_unmapped" : false,
            "from" : 0,
            "size" : 3,
            "version" : false,
            "explain" : false,
            "track_scores" : false
          }
        }
      }
    ],
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
+0 −25
Original line number Diff line number Diff line
@@ -26,31 +26,6 @@
        }
      }
    ],
    "should" : [
      {
        "has_child" : {
          "query" : {
            "match_all" : {
              "boost" : 1.0
            }
          },
          "type" : "attributeseries",
          "score_mode" : "avg",
          "min_children" : 0,
          "max_children" : 2147483647,
          "ignore_unmapped" : false,
          "boost" : 1.0,
          "inner_hits" : {
            "ignore_unmapped" : false,
            "from" : 0,
            "size" : 3,
            "version" : false,
            "explain" : false,
            "track_scores" : false
          }
        }
      }
    ],
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
+0 −25
Original line number Diff line number Diff line
@@ -53,31 +53,6 @@
        }
      }
    ],
    "should" : [
      {
        "has_child" : {
          "query" : {
            "match_all" : {
              "boost" : 1.0
            }
          },
          "type" : "attributeseries",
          "score_mode" : "avg",
          "min_children" : 0,
          "max_children" : 2147483647,
          "ignore_unmapped" : false,
          "boost" : 1.0,
          "inner_hits" : {
            "ignore_unmapped" : false,
            "from" : 0,
            "size" : 3,
            "version" : false,
            "explain" : false,
            "track_scores" : false
          }
        }
      }
    ],
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }