Exemplo n.º 1
0
		public ElasticQuery(IQuery query, SortItem sortItem, int from, int size)
		{
			Query = query;
			SortItems = new List<SortItem>() { sortItem };
			From = from;
			Size = size;
		}
Exemplo n.º 2
0
 public ElasticQuery AddSortItem(SortItem sortItem)
 {
     if (SortItems == null)
     {
         SortItems = new List <SortItem>();
     }
     SortItems.Add(sortItem);
     return(this);
 }
Exemplo n.º 3
0
		public ElasticQuery(IQuery query, SortItem sortItem=null, int from=0, int size=5)
		{
			Query = query;
		    if (sortItem != null)
		    {
		        SortItems = new List<SortItem>() { sortItem };
		    }
		    From = from;
			Size = size;
		}
Exemplo n.º 4
0
 public ElasticQuery(IQuery query, SortItem sortItem = null, int from = 0, int size = 5)
 {
     Query = query;
     if (sortItem != null)
     {
         SortItems = new List <SortItem>()
         {
             sortItem
         };
     }
     From = from;
     Size = size;
 }
Exemplo n.º 5
0
		public ElasticQuery AddSortItem(SortItem sortItem)
		{
			EnsureSortItemsExist();
			SortItems.Add(sortItem);
			return this;
		}
Exemplo n.º 6
0
		public ElasticQuery AddSortItem(SortItem sortItem)
		{
			if (SortItems == null) { SortItems = new List<SortItem>(); }
			SortItems.Add(sortItem);
			return this;
		}
Exemplo n.º 7
0
 public ElasticQuery AddSortItem(SortItem sortItem)
 {
     EnsureSortItemsExist();
     SortItems.Add(sortItem);
     return(this);
 }
		public SearchResult Search(string index, string[] type, IQuery query,SortItem sortItem, int from, int size, string[] fields = null)
		{
			Contract.Assert(!string.IsNullOrEmpty(index));
			Contract.Assert(query != null);
			Contract.Assert(from >= 0);
			Contract.Assert(size > 0);

			var elasticQuery = new ElasticQuery(from, size);
			elasticQuery.SetQuery(query);
			if (sortItem != null)
			{
				elasticQuery.AddSortItem(sortItem);
			}
			if (fields != null) elasticQuery.AddFields(fields);

			return Search(index, type, elasticQuery);
		}
		public SearchResult Search(string index, string type, IQuery query,SortItem sortItem, int from = 0, int size = 5, string[] fields = null)
		{
			string[] temp = null;
			if (type != null) temp = new[] { type };
			return Search(index, temp, query,sortItem, from, size, fields);
		}
		public SearchResult Search(string index, string[] type, IQuery query,SortItem sortItem, int from, int size, string[] fields = null)
		{
		    return Search(index, type, query, from, size,
		                  sortItem == null ? Enumerable.Empty<SortItem>() : Enumerable.Repeat(sortItem, 1), fields);
		}