public static Field BuildField(string name, object val, IAzureProviderIndex index)
        {
            var fld = index.AzureConfiguration.FieldMap.GetFieldConfiguration(name) as AzureSearchFieldConfiguration;
            if (fld != null)
            {
                return BuildField(name, fld);
            }

            var dataType = DataType.String;
            dataType = AzureDocumentBuilder.GetDataType(val);
            var searchable = dataType == DataType.String;

            //Build new Field
            var field = new Field()
            {
                IsFacetable = false,
                IsFilterable = false,
                IsKey = false,
                IsRetrievable = true,
                IsSearchable = searchable,
                IsSortable = true,
                Name = name,
                Type = dataType
            };

            return field;
        }
 public AzureField(string name, object value, Field field, Microsoft.Azure.Search.Models.DataType dataType = null)
 {
     Name = name;
     Value = value;
     Field = field;
     DataType = dataType ?? Microsoft.Azure.Search.Models.DataType.String;
 }
 private static Field BuildField(string name, AzureSearchFieldConfiguration fieldConfiguration)
 {
     var fld = new Field();
     fieldConfiguration.SetValues();
     fld.IsFacetable = fieldConfiguration.IsFacetable;
     fld.IsFilterable = fieldConfiguration.IsFilterable;
     fld.IsKey = fieldConfiguration.IsKey;
     fld.IsRetrievable = fieldConfiguration.IsRetrievable;
     fld.IsSearchable = fieldConfiguration.IsSearchable;
     fld.IsSortable = fieldConfiguration.IsSortable;
     fld.Name = name;
     fld.Type = fieldConfiguration.Type ?? DataType.String;
     return fld;
 }
 public static Field CreateField(string name, object value, AzureSearchFieldConfiguration fieldConfiguration, IIndexFieldStorageValueFormatter indexFieldStorageValueFormatter)
 {
     if (value == null)
     {
         VerboseLogging.CrawlingLogDebug((Func<string>)(() => string.Format("Skipping field {0} - value null", (object)name)));
         return (Field)null;
     }
     if (fieldConfiguration == null)
         throw new ArgumentNullException("fieldConfiguration");
     if (VerboseLogging.Enabled)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendFormat("Field: {0}" + Environment.NewLine, (object)name);
         stringBuilder.AppendFormat(" - value: {0}" + Environment.NewLine, (object)value.GetType());
         stringBuilder.AppendFormat(" - value: {0}" + Environment.NewLine, value);
         //stringBuilder.AppendFormat(" - fieldConfiguration analyzer: {0}" + Environment.NewLine, fieldConfiguration.Analyzer != null ? (object)fieldConfiguration.Analyzer.GetType().ToString() : (object)"NULL");
         stringBuilder.AppendFormat(" - fieldConfiguration boost: {0}" + Environment.NewLine, (object)fieldConfiguration.Boost);
         stringBuilder.AppendFormat(" - fieldConfiguration fieldID: {0}" + Environment.NewLine, (object)fieldConfiguration.FieldID);
         stringBuilder.AppendFormat(" - fieldConfiguration FieldName: {0}" + Environment.NewLine, (object)fieldConfiguration.FieldName);
         stringBuilder.AppendFormat(" - fieldConfiguration FieldTypeName: {0}" + Environment.NewLine, (object)fieldConfiguration.FieldTypeName);
         //stringBuilder.AppendFormat(" - fieldConfiguration IndexType: {0}" + Environment.NewLine, (object)fieldConfiguration.IndexType);
         //stringBuilder.AppendFormat(" - fieldConfiguration StorageType: {0}" + Environment.NewLine, (object)fieldConfiguration.StorageType);
         //stringBuilder.AppendFormat(" - fieldConfiguration VectorType: {0}" + Environment.NewLine, (object)fieldConfiguration.VectorType);
         stringBuilder.AppendFormat(" - fieldConfiguration Type: {0}" + Environment.NewLine, (object)fieldConfiguration.Type);
         VerboseLogging.CrawlingLogDebug(new Func<string>(((object)stringBuilder).ToString));
     }
     if (AzureFieldBuilder.IsNumericField(fieldConfiguration.Type))
     {
         if (value is string && string.IsNullOrEmpty((string)value))
         {
             VerboseLogging.CrawlingLogDebug((Func<string>)(() => string.Format("Skipping field {0} - value or empty null", (object)name)));
             return (Field)null;
         }
         long result;
         if (long.TryParse(value.ToString(), out result))
         {
             var numericField = new Field(name, DataType.Int64);
             //TODO: How to set value?
             //numericField.((long)Convert.ChangeType(value, typeof(long)));
             return numericField;
         }
     }
     if (AzureFieldBuilder.IsFloatingPointField(fieldConfiguration.Type))
     {
         if (value is string && string.IsNullOrEmpty((string)value))
         {
             VerboseLogging.CrawlingLogDebug((Func<string>)(() => string.Format("Skipping field {0} - value or empty null", (object)name)));
             return (Field)null;
         }
         var numericField = new Field(name, DataType.Double);
         //numericField.SetDoubleValue((double)Convert.ChangeType(value, typeof(double), (IFormatProvider)LanguageUtil.GetCultureInfo()));
         return (Field)numericField;
     }
     string value_Renamed = indexFieldStorageValueFormatter.FormatValueForIndexStorage(value, name).ToString();
     if (VerboseLogging.Enabled)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendFormat("Field: {0}" + Environment.NewLine, (object)name);
         stringBuilder.AppendFormat(" - formattedValue: {0}" + Environment.NewLine, (object)value_Renamed);
         VerboseLogging.CrawlingLogDebug(new Func<string>(((object)stringBuilder).ToString));
     }
     //TODO: How to set field value?
     return (Field)new Field(name, DataType.String /*, value_Renamed*/);
 }