示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="indexName">The name of the field that will be stored in the index. Defaults to the property/field name.</param>
        /// <param name="format">The date format. Defaults to dateOptionalTime.</param>
        /// <param name="store">Set to yes the store actual field in the index, no to not store it. Defaults to no (note, the JSON document itself is stored, and it can be retrieved from it).</param>
        /// <param name="index">Set to no if the value should not be indexed. In this case, store should be set to yes, since if its not indexed and not stored, there is nothing to do with it.</param>
        /// <param name="precisionStep">The precision step (number of terms generated for each number value). Defaults to 4.</param>
        /// <param name="boost">The boost value. Defaults to 1.0.</param>
        /// <param name="nullValue">When there is a (JSON) null value for the field, use the null_value as the field value. Defaults to not adding the field at all.</param>
        /// <param name="includeInAll">Should the field be included in the _all field (if enabled). Defaults to true or to the parent object type setting.</param>
        public DateFieldSetting AddDateField(string name, string indexName = null,
                                             string format     = null,
                                             Store store       = Store.no,
                                             IndexType index   = IndexType.analyzed,
                                             int precisionStep = 4,
                                             double boost      = 1.0,
                                             string nullValue  = null,
                                             bool includeInAll = true)
        {
            Contract.Assert(_fieldSettings != null);

            var field = new DateFieldSetting();

            field.Name          = name;
            field.IndexName     = indexName;
            field.Format        = format;
            field.Store         = store;
            field.Index         = index;
            field.PrecisionStep = precisionStep;
            field.Boost         = boost;
            field.NullValue     = nullValue;
            field.IncludeInAll  = includeInAll;

            _fieldSettings[name] = field;
            return(field);
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="indexName">The name of the field that will be stored in the index. Defaults to the property/field name.</param>
		/// <param name="format">The date format. Defaults to dateOptionalTime.</param>
		/// <param name="store">Set to yes the store actual field in the index, no to not store it. Defaults to no (note, the JSON document itself is stored, and it can be retrieved from it).</param>
		/// <param name="index">Set to no if the value should not be indexed. In this case, store should be set to yes, since if its not indexed and not stored, there is nothing to do with it.</param>
		/// <param name="precisionStep">The precision step (number of terms generated for each number value). Defaults to 4.</param>
		/// <param name="boost">The boost value. Defaults to 1.0.</param>
		/// <param name="nullValue">When there is a (JSON) null value for the field, use the null_value as the field value. Defaults to not adding the field at all.</param>
		/// <param name="includeInAll">Should the field be included in the _all field (if enabled). Defaults to true or to the parent object type setting.</param>
        public DateFieldSetting AddDateField(string name, string indexName = null,
									string format = null,
									Store store = Store.no,
									IndexType index = IndexType.analyzed,
									int precisionStep = 4,
									double boost = 1.0,
									string nullValue = null,
									bool includeInAll = true)
		{
			Contract.Assert(_fieldSettings != null);

			var field = new DateFieldSetting();
			field.Name = name;
			field.IndexName = indexName;
			field.Format = format;
			field.Store = store;
			field.Index = index;
			field.PrecisionStep = precisionStep;
			field.Boost = boost;
			field.NullValue = nullValue;
			field.IncludeInAll = includeInAll;

			_fieldSettings[name] = field;
		    return field;
		}