コード例 #1
0
        private IBucket GetSignificantTermsBucket(ref JsonReader reader, IJsonFormatterResolver formatterResolver, object key, string keyAsString,
                                                  long?docCount
                                                  )
        {
            var score = reader.ReadDouble();

            reader.ReadNext();             // ,
            reader.ReadNext();             // "bg_count"
            reader.ReadNext();             // :
            var bgCount = reader.ReadInt64();

            Dictionary <string, IAggregate> subAggregates = null;

            if (reader.GetCurrentJsonToken() == JsonToken.ValueSeparator)
            {
                reader.ReadNext();                 // ,
                var propertyName = reader.ReadPropertyName();
                subAggregates = GetSubAggregates(ref reader, propertyName, formatterResolver);
            }
            else
            {
                reader.ReadNext();                 // }
            }
            var significantTermItem = new SignificantTermsBucket(subAggregates)
            {
                Key      = (string)key,
                DocCount = docCount.GetValueOrDefault(0),
                BgCount  = bgCount,
                Score    = score
            };

            return(significantTermItem);
        }
コード例 #2
0
        private IBucket GetSignificantTermsBucket(JsonReader reader, JsonSerializer serializer, KeyedBucket keyItem)
        {
            reader.Read();
            var score = reader.Value as double?;

            reader.Read();
            reader.Read();
            var bgCount             = reader.Value as long?;
            var significantTermItem = new SignificantTermsBucket()
            {
                Key      = keyItem.Key,
                DocCount = keyItem.DocCount.GetValueOrDefault(0),
                BgCount  = bgCount.GetValueOrDefault(0),
                Score    = score.GetValueOrDefault(0)
            };

            reader.Read();
            significantTermItem.Aggregations = this.GetSubAggregates(reader, serializer);
            return(significantTermItem);
        }
コード例 #3
0
        private IBucket GetSignificantTermsBucket(JsonReader reader, JsonSerializer serializer, object key, string keyAsString, long?docCount)
        {
            reader.Read();
            var score = reader.Value as double?;

            reader.Read();
            reader.Read();
            var bgCount = reader.Value as long?;

            reader.Read();
            var nestedAggregations  = this.GetSubAggregates(reader, serializer);
            var significantTermItem = new SignificantTermsBucket(nestedAggregations)
            {
                Key      = key as string,
                DocCount = docCount.GetValueOrDefault(0),
                BgCount  = bgCount.GetValueOrDefault(0),
                Score    = score.GetValueOrDefault(0)
            };

            return(significantTermItem);
        }
コード例 #4
0
		private IBucket GetSignificantTermsBucket(JsonReader reader, JsonSerializer serializer, KeyedBucket<object> keyItem)
		{
			reader.Read();
			var score = reader.Value as double?;
			reader.Read();
			reader.Read();
			var bgCount = reader.Value as long?;
			var significantTermItem = new SignificantTermsBucket()
			{
				Key = keyItem.Key as string,
				DocCount = keyItem.DocCount.GetValueOrDefault(0),
				BgCount = bgCount.GetValueOrDefault(0),
				Score = score.GetValueOrDefault(0)
			};
			reader.Read();
			significantTermItem.Aggregations = this.GetSubAggregates(reader, serializer);
			return significantTermItem;
		}