Exemplo n.º 1
0
        private HashSet <string> GetIndexes(IRepositoryQuery query)
        {
            var indexes = new HashSet <string>();

            var elasticIndexes = query.GetElasticIndexes();

            if (elasticIndexes.Count > 0)
            {
                indexes.AddRange(elasticIndexes);
            }

            if (query.GetElasticIndexesStartUtc().HasValue || query.GetElasticIndexesEndUtc().HasValue)
            {
                indexes.AddRange(TimeSeriesIndex.GetIndexes(query.GetElasticIndexesStartUtc(), query.GetElasticIndexesEndUtc()));
            }

            return(indexes);
        }
        public virtual string[] GetIndexesByQuery(object query)
        {
            var withIndexesQuery = query as IElasticIndexesQuery;

            if (withIndexesQuery == null)
            {
                return(_defaultIndexes);
            }

            var indexes = new List <string>();

            if (withIndexesQuery.Indexes.Count > 0)
            {
                indexes.AddRange(withIndexesQuery.Indexes);
            }

            if (withIndexesQuery.UtcStartIndex.HasValue || withIndexesQuery.UtcEndIndex.HasValue)
            {
                indexes.AddRange(TimeSeriesIndex.GetIndexes(withIndexesQuery.UtcStartIndex, withIndexesQuery.UtcEndIndex));
            }

            return(indexes.Count > 0 ? indexes.ToArray() : _defaultIndexes);
        }