Inheritance: AbstractSearchFieldConfiguration
        private void AddComputedIndexField(IComputedIndexField computedIndexField, object fieldValue)
        {
            AzureSearchFieldConfiguration fieldSettings = this.Index.Configuration.FieldMap.GetFieldConfiguration(computedIndexField.FieldName) as AzureSearchFieldConfiguration;

            if (fieldValue is IEnumerable && !(fieldValue is string))
            {
                foreach (object fieldValue1 in fieldValue as IEnumerable)
                {
                    if (fieldSettings != null)
                    {
                        this.AddField(computedIndexField.FieldName, fieldValue1, fieldSettings, 0.0f);
                    }
                    else
                    {
                        this.AddField(computedIndexField.FieldName, fieldValue1, false);
                    }
                }
            }
            else if (fieldSettings != null)
            {
                this.AddField(computedIndexField.FieldName, fieldValue, fieldSettings, 0.0f);
            }
            else
            {
                this.AddField(computedIndexField.FieldName, fieldValue, false);
            }
        }
        protected void AddField(string name, object value, AzureSearchFieldConfiguration fieldSettings, float boost = 0.0f)
        {
            Assert.IsNotNull((object)fieldSettings, "fieldSettings");
            name   = this.Index.FieldNameTranslator.GetIndexFieldName(name);
            boost += fieldSettings.Boost;
            IEnumerable enumerable = value as IEnumerable;

            if (enumerable != null && !(value is string))
            {
                foreach (object valueToIndex in enumerable)
                {
                    object obj   = fieldSettings.FormatForWriting(valueToIndex);
                    Field  field = AzureFieldBuilder.CreateField(name, obj, fieldSettings, this.Index.Configuration.IndexFieldStorageValueFormatter);
                    if (field != null)
                    {
                        //TODO: How to figure out boost
                        //field.Boost = boost;
                        this.fields.Enqueue(field);
                    }
                }
            }
            else
            {
                value = fieldSettings.FormatForWriting(value);
                var field = AzureFieldBuilder.CreateField(name, value, fieldSettings, this.Index.Configuration.IndexFieldStorageValueFormatter);
                if (field == null)
                {
                    return;
                }

                //TODO: How to figure out boost
                //field.Boost = boost;
                this.fields.Enqueue(field);
            }
        }
        public override void AddField(string fieldName, object fieldValue, bool append = false)
        {
            AbstractSearchFieldConfiguration fieldConfiguration = this.Context.Index.Configuration.FieldMap.GetFieldConfiguration(fieldName);
            string fieldName1 = fieldName;

            fieldName = this.Index.FieldNameTranslator.GetIndexFieldName(fieldName);
            AzureSearchFieldConfiguration fieldSettings = this.Index.Configuration.FieldMap.GetFieldConfiguration(fieldName) as AzureSearchFieldConfiguration;

            if (fieldSettings != null)
            {
                if (fieldConfiguration != null)
                {
                    fieldValue = fieldConfiguration.FormatForWriting(fieldValue);
                }
                this.AddField(fieldName, fieldValue, fieldSettings, 0.0f);
            }
            else
            {
                if (VerboseLogging.Enabled)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendFormat("Field: {0} (Adding field with no field configuration)" + Environment.NewLine, (object)fieldName);
                    stringBuilder.AppendFormat(" - value: {0}" + Environment.NewLine, fieldValue != null ? (object)fieldValue.GetType().ToString() : (object)"NULL");
                    stringBuilder.AppendFormat(" - value: {0}" + Environment.NewLine, fieldValue);
                    VerboseLogging.CrawlingLogDebug(new Func <string>(((object)stringBuilder).ToString));
                }
                IEnumerable enumerable = fieldValue as IEnumerable;
                if (enumerable != null && !(fieldValue is string))
                {
                    foreach (object obj in enumerable)
                    {
                        object valueToIndex = this.Index.Configuration.IndexFieldStorageValueFormatter.FormatValueForIndexStorage(obj, fieldName1);
                        if (fieldConfiguration != null)
                        {
                            valueToIndex = fieldConfiguration.FormatForWriting(valueToIndex);
                        }
                        if (valueToIndex != null)
                        {
                            this.fields.Enqueue((Field) new Field(fieldName, valueToIndex.ToString()));
                        }
                    }
                }
                else
                {
                    object valueToIndex = this.Index.Configuration.IndexFieldStorageValueFormatter.FormatValueForIndexStorage(fieldValue, fieldName1);
                    if (fieldConfiguration != null)
                    {
                        valueToIndex = fieldConfiguration.FormatForWriting(valueToIndex);
                    }
                    if (valueToIndex == null)
                    {
                        return;
                    }

                    //TODO:  How to figure out setting field value
                    this.fields.Enqueue((Field) new Field(fieldName, DataType.String /*, valueToIndex.ToString()*/));
                }
            }
        }
        public override void AddField(IIndexableDataField field)
        {
            AbstractSearchFieldConfiguration fieldConfiguration1 = this.Context.Index.Configuration.FieldMap.GetFieldConfiguration(field);
            object fieldValue = this.Index.Configuration.FieldReaders.GetFieldValue(field);
            string name       = field.Name;
            AzureSearchFieldConfiguration fieldSettings = this.Index.Configuration.FieldMap.GetFieldConfiguration(field) as AzureSearchFieldConfiguration;

            if (fieldSettings == null)
            {
                VerboseLogging.CrawlingLogDebug((Func <string>)(() => string.Format("Cannot resolve field settings for field id:{0}, name:{1}, typeKey:{2} - The field will not be added to the index.", field.Id, (object)field.Name, (object)field.TypeKey)));
            }
            else
            {
                object obj   = fieldConfiguration1.FormatForWriting(fieldValue);
                float  boost = BoostingManager.ResolveFieldBoosting(field);
                if (IndexOperationsHelper.IsTextField(field))
                {
                    AzureSearchFieldConfiguration fieldConfiguration2 = this.Index.Configuration.FieldMap.GetFieldConfiguration("_content") as AzureSearchFieldConfiguration;
                    this.AddField("_content", obj, fieldConfiguration2 ?? this.defaultTextField, 0.0f);
                }
                this.AddField(name, obj, fieldSettings, boost);
            }
        }
        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*/));
        }
 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*/);
 }