<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Elasticsearch.Net;
using Nest.Resolvers;

namespace Nest
{
	public interface IDocumentOptionalPath<TParameters> : IRequest<TParameters>
		where TParameters : IRequestParameters, new()
	{
		IndexNameMarker Index { get; set; }
		TypeNameMarker Type { get; set; }
		string Id { get; set; }
		object IdFrom { get; set; }
	}

	internal static class DocumentOptionalPathRouteParameters
	{
		public static void SetRouteParameters<TParameters>(
			IDocumentOptionalPath<TParameters> path,
			IConnectionSettingsValues settings,
			ElasticsearchPathInfo<TParameters> pathInfo)
			where TParameters : IRequestParameters, new()
		{
			var inferrer = new ElasticInferrer(settings);

			pathInfo.Index = inferrer.IndexName(path.Index);
			pathInfo.Type = inferrer.TypeName(path.Type);
			pathInfo.Id = path.Id ?? inferrer.Id(path.IdFrom);
		}

		public static void SetRouteParameters<TParameters, T>(
			IDocumentOptionalPath<TParameters> path,
			IConnectionSettingsValues settings,
			ElasticsearchPathInfo<TParameters> pathInfo)
			where TParameters : IRequestParameters, new()
			where T : class
		{
			var inferrer = new ElasticInferrer(settings);

			var index = path.Index != null ? inferrer.IndexName(path.Index) : inferrer.IndexName<T>();
			var type = path.Type != null ? inferrer.TypeName(path.Type) : inferrer.TypeName<T>();
			var id = path.Id ?? inferrer.Id(path.IdFrom);

			pathInfo.Index = index;
			pathInfo.Type = type;
			pathInfo.Id = id;
		}

	}

	public abstract class DocumentOptionalPathBase<TParameters> : BasePathRequest<TParameters>, IDocumentOptionalPath<TParameters>
		where TParameters : FluentRequestParameters<TParameters>, new()
	{
		public IndexNameMarker Index { get; set; }
		public TypeNameMarker Type { get; set; }
		public string Id { get; set; }
		public object IdFrom { get; set; }

		protected override void SetRouteParameters(
			IConnectionSettingsValues settings, ElasticsearchPathInfo<TParameters> pathInfo)
		{
			DocumentOptionalPathRouteParameters.SetRouteParameters(this, settings, pathInfo);
		}
	}

	public abstract class DocumentOptionalPathBase<TParameters, T> : DocumentOptionalPathBase<TParameters>
		where TParameters : IRequestParameters, new()
		where T : class
	{
		protected override void SetRouteParameters(IConnectionSettingsValues settings, ElasticsearchPathInfo<TParameters> pathInfo)
		{
			DocumentOptionalPathRouteParameters.SetRouteParameters<TParameters, T>(this, settings, pathInfo);
		}
	}<commit_msg>Correct TParameters type<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Elasticsearch.Net;
using Nest.Resolvers;

namespace Nest
{
	public interface IDocumentOptionalPath<TParameters> : IRequest<TParameters>
		where TParameters : IRequestParameters, new()
	{
		IndexNameMarker Index { get; set; }
		TypeNameMarker Type { get; set; }
		string Id { get; set; }
		object IdFrom { get; set; }
	}

	internal static class DocumentOptionalPathRouteParameters
	{
		public static void SetRouteParameters<TParameters>(
			IDocumentOptionalPath<TParameters> path,
			IConnectionSettingsValues settings,
			ElasticsearchPathInfo<TParameters> pathInfo)
			where TParameters : IRequestParameters, new()
		{
			var inferrer = new ElasticInferrer(settings);

			pathInfo.Index = inferrer.IndexName(path.Index);
			pathInfo.Type = inferrer.TypeName(path.Type);
			pathInfo.Id = path.Id ?? inferrer.Id(path.IdFrom);
		}

		public static void SetRouteParameters<TParameters, T>(
			IDocumentOptionalPath<TParameters> path,
			IConnectionSettingsValues settings,
			ElasticsearchPathInfo<TParameters> pathInfo)
			where TParameters : IRequestParameters, new()
			where T : class
		{
			var inferrer = new ElasticInferrer(settings);

			var index = path.Index != null ? inferrer.IndexName(path.Index) : inferrer.IndexName<T>();
			var type = path.Type != null ? inferrer.TypeName(path.Type) : inferrer.TypeName<T>();
			var id = path.Id ?? inferrer.Id(path.IdFrom);

			pathInfo.Index = index;
			pathInfo.Type = type;
			pathInfo.Id = id;
		}

	}

	public abstract class DocumentOptionalPathBase<TParameters> : BasePathRequest<TParameters>, IDocumentOptionalPath<TParameters>
		where TParameters : IRequestParameters, new()
	{
		public IndexNameMarker Index { get; set; }
		public TypeNameMarker Type { get; set; }
		public string Id { get; set; }
		public object IdFrom { get; set; }

		protected override void SetRouteParameters(
			IConnectionSettingsValues settings, ElasticsearchPathInfo<TParameters> pathInfo)
		{
			DocumentOptionalPathRouteParameters.SetRouteParameters(this, settings, pathInfo);
		}
	}

	public abstract class DocumentOptionalPathBase<TParameters, T> : DocumentOptionalPathBase<TParameters>
		where TParameters : IRequestParameters, new()
		where T : class
	{
		protected override void SetRouteParameters(IConnectionSettingsValues settings, ElasticsearchPathInfo<TParameters> pathInfo)
		{
			DocumentOptionalPathRouteParameters.SetRouteParameters<TParameters, T>(this, settings, pathInfo);
		}
	}
{'fraction_non_alphanumeric': 0.09160007795751315, 'fraction_numerical': 0.0, 'mean_word_length': 5.266178266178266, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3516683', 'n_tokens_mistral': 1629, 'n_tokens_neox': 1476, 'n_words': 354}