<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Nest.Resolvers.Converters;
using System.Linq.Expressions;
using Nest.DSL.Descriptors;
using Nest.Resolvers;

namespace Nest
{
	[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
	public class SearchDescriptor<T> where T : class
	{
		private readonly TypeNameResolver typeNameResolver;

		public SearchDescriptor()
		{
			this.typeNameResolver = new TypeNameResolver();
		}
		internal IEnumerable<string> _Indices { get; set; }
		internal IEnumerable<string> _Types { get; set; }
		internal string _Routing { get; set; }
		internal SearchType?  _SearchType { get; set; }
		internal string _Scroll { get; set; }
		internal bool _AllIndices { get; set; }
		internal bool _AllTypes { get; set; }

		/// <summary>
		/// Whiter conditionless queries are allowed or not
		/// </summary>
		internal bool _Strict { get; set; }

		/// <summary>
		/// The indices to execute the search on. Defaults to the default index
		/// </summary>
		public SearchDescriptor<T> Indices(IEnumerable<string> indices)
		{
			indices.ThrowIfEmpty("indices");
			this._Indices = indices;
			return this;
		}
		/// <summary>
		/// The index to execute the search on. Defaults to the default index
		/// </summary>
		public SearchDescriptor<T> Index(string index)
		{
			index.ThrowIfNullOrEmpty("indices");
			this._Indices = new[] { index };
			return this;
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(IEnumerable<string> types)
		{
			types.ThrowIfEmpty("types");
			this._Types = types;
			return this;
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(params string[] types)
		{
			return this.Types((IEnumerable<string>)types);
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(IEnumerable<Type> types)
		{
			types.ThrowIfEmpty("types");
			return this.Types((IEnumerable<string>)types.Select(t => this.typeNameResolver.GetTypeNameFor(t)).ToArray());
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(params Type[] types)
		{
			return this.Types((IEnumerable<Type>)types);
		}
		/// <summary>
		/// The type to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Type(string type)
		{
			type.ThrowIfNullOrEmpty("type");
			this._Types = new[] { type };
			return this;
		}
		/// <summary>
		/// The type to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Type(Type type)
		{
			type.ThrowIfNull("type");
			return this.Type(this.typeNameResolver.GetTypeNameFor(type));
		}
		/// <summary>
		/// Execute search over all indices
		/// </summary>
		public SearchDescriptor<T> AllIndices()
		{
			this._AllIndices = true;
			return this;
		}
		/// <summary>
		/// Execute search over all types
		/// </summary>
		public SearchDescriptor<T> AllTypes()
		{
			this._AllTypes = true;
			return this;
		}
		/// <summary>
		/// When executing a search, it will be broadcasted to all the index/indices shards (round robin between replicas).
		/// Which shards will be searched on can be controlled by providing the routing parameter.
		/// </summary>
		public SearchDescriptor<T> Routing(string routing)
		{
			routing.ThrowIfNullOrEmpty("routing");
			this._Routing = routing;
			return this;
		}
		/// <summary>
		/// controls how the distributed search behaves. http://www.elasticsearch.org/guide/reference/api/search/search-type.html
		/// </summary>
		public SearchDescriptor<T> SearchType(SearchType searchType)
		{
			searchType.ThrowIfNull("searchType");
			this._SearchType = searchType;
			return this;
		}
		/// <summary>
		/// A search request can be scrolled by specifying the scroll parameter. The scroll parameter is a time value parameter (for example: scroll=5m), indicating for how long the nodes that participate in the search will maintain relevant resources in order to continue and support it. This is very similar in its idea to opening a cursor against a database.
		/// </summary>
		/// <param name="scrollTime">The scroll parameter is a time value parameter (for example: scroll=5m)</param>
		/// <returns></returns>
		public SearchDescriptor<T> Scroll(string scrollTime)
		{
			scrollTime.ThrowIfNullOrEmpty("scrollTime");
			this._Scroll = scrollTime;
			return this;
		}
		/// <summary>
		/// When strict is set, conditionless queries are treated as an exception. 
		public SearchDescriptor<T> Strict(bool strict = true)
		{
			this._Strict = strict;
			return this;
		}

		[JsonProperty(PropertyName = "timeout")]
		internal string _Timeout { get; set; }
		[JsonProperty(PropertyName = "from")]
		internal int? _From { get; set; }
		[JsonProperty(PropertyName = "size")]
		internal int? _Size { get; set; }
		[JsonProperty(PropertyName = "explain")]
		internal bool? _Explain { get; set; }
		[JsonProperty(PropertyName = "version")]
		internal bool? _Version { get; set; }
		[JsonProperty(PropertyName = "track_scores ")]
		internal bool? _TrackScores { get; set; }

		[JsonProperty(PropertyName = "min_score")]
		internal double? _MinScore { get; set; }

		[JsonProperty(PropertyName = "preference")]
		internal string _Preference { get; set; }

		[JsonProperty(PropertyName = "indices_boost")]
		internal IDictionary<string, double> _IndicesBoost { get; set; }
<commit_msg>Fixed space at end of Track Scroes<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Nest.Resolvers.Converters;
using System.Linq.Expressions;
using Nest.DSL.Descriptors;
using Nest.Resolvers;

namespace Nest
{
	[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
	public class SearchDescriptor<T> where T : class
	{
		private readonly TypeNameResolver typeNameResolver;

		public SearchDescriptor()
		{
			this.typeNameResolver = new TypeNameResolver();
		}
		internal IEnumerable<string> _Indices { get; set; }
		internal IEnumerable<string> _Types { get; set; }
		internal string _Routing { get; set; }
		internal SearchType?  _SearchType { get; set; }
		internal string _Scroll { get; set; }
		internal bool _AllIndices { get; set; }
		internal bool _AllTypes { get; set; }

		/// <summary>
		/// Whiter conditionless queries are allowed or not
		/// </summary>
		internal bool _Strict { get; set; }

		/// <summary>
		/// The indices to execute the search on. Defaults to the default index
		/// </summary>
		public SearchDescriptor<T> Indices(IEnumerable<string> indices)
		{
			indices.ThrowIfEmpty("indices");
			this._Indices = indices;
			return this;
		}
		/// <summary>
		/// The index to execute the search on. Defaults to the default index
		/// </summary>
		public SearchDescriptor<T> Index(string index)
		{
			index.ThrowIfNullOrEmpty("indices");
			this._Indices = new[] { index };
			return this;
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(IEnumerable<string> types)
		{
			types.ThrowIfEmpty("types");
			this._Types = types;
			return this;
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(params string[] types)
		{
			return this.Types((IEnumerable<string>)types);
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(IEnumerable<Type> types)
		{
			types.ThrowIfEmpty("types");
			return this.Types((IEnumerable<string>)types.Select(t => this.typeNameResolver.GetTypeNameFor(t)).ToArray());
		}
		/// <summary>
		/// The types to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Types(params Type[] types)
		{
			return this.Types((IEnumerable<Type>)types);
		}
		/// <summary>
		/// The type to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Type(string type)
		{
			type.ThrowIfNullOrEmpty("type");
			this._Types = new[] { type };
			return this;
		}
		/// <summary>
		/// The type to execute the search on. Defaults to the inferred typename of T 
		/// unless T is dynamic then a type (or AllTypes()) MUST be specified.
		/// </summary>
		public SearchDescriptor<T> Type(Type type)
		{
			type.ThrowIfNull("type");
			return this.Type(this.typeNameResolver.GetTypeNameFor(type));
		}
		/// <summary>
		/// Execute search over all indices
		/// </summary>
		public SearchDescriptor<T> AllIndices()
		{
			this._AllIndices = true;
			return this;
		}
		/// <summary>
		/// Execute search over all types
		/// </summary>
		public SearchDescriptor<T> AllTypes()
		{
			this._AllTypes = true;
			return this;
		}
		/// <summary>
		/// When executing a search, it will be broadcasted to all the index/indices shards (round robin between replicas).
		/// Which shards will be searched on can be controlled by providing the routing parameter.
		/// </summary>
		public SearchDescriptor<T> Routing(string routing)
		{
			routing.ThrowIfNullOrEmpty("routing");
			this._Routing = routing;
			return this;
		}
		/// <summary>
		/// controls how the distributed search behaves. http://www.elasticsearch.org/guide/reference/api/search/search-type.html
		/// </summary>
		public SearchDescriptor<T> SearchType(SearchType searchType)
		{
			searchType.ThrowIfNull("searchType");
			this._SearchType = searchType;
			return this;
		}
		/// <summary>
		/// A search request can be scrolled by specifying the scroll parameter. The scroll parameter is a time value parameter (for example: scroll=5m), indicating for how long the nodes that participate in the search will maintain relevant resources in order to continue and support it. This is very similar in its idea to opening a cursor against a database.
		/// </summary>
		/// <param name="scrollTime">The scroll parameter is a time value parameter (for example: scroll=5m)</param>
		/// <returns></returns>
		public SearchDescriptor<T> Scroll(string scrollTime)
		{
			scrollTime.ThrowIfNullOrEmpty("scrollTime");
			this._Scroll = scrollTime;
			return this;
		}
		/// <summary>
		/// When strict is set, conditionless queries are treated as an exception. 
		public SearchDescriptor<T> Strict(bool strict = true)
		{
			this._Strict = strict;
			return this;
		}

		[JsonProperty(PropertyName = "timeout")]
		internal string _Timeout { get; set; }
		[JsonProperty(PropertyName = "from")]
		internal int? _From { get; set; }
		[JsonProperty(PropertyName = "size")]
		internal int? _Size { get; set; }
		[JsonProperty(PropertyName = "explain")]
		internal bool? _Explain { get; set; }
		[JsonProperty(PropertyName = "version")]
		internal bool? _Version { get; set; }
		[JsonProperty(PropertyName = "track_scores")]
		internal bool? _TrackScores { get; set; }

		[JsonProperty(PropertyName = "min_score")]
		internal double? _MinScore { get; set; }

		[JsonProperty(PropertyName = "preference")]
		internal string _Preference { get; set; }

		[JsonProperty(PropertyName = "indices_boost")]
		internal IDictionary<string, double> _IndicesBoost { get; set; }

{'fraction_non_alphanumeric': 0.12023084321898045, 'fraction_numerical': 0.0003206155819172812, 'mean_word_length': 3.5173787110789285, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4032846', 'n_tokens_mistral': 4090, 'n_tokens_neox': 3643, 'n_words': 1218}