EnsureHasField() public method

public EnsureHasField ( string ensuredFieldName ) : void
ensuredFieldName string
return void
示例#1
0
        protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch, ScoreDoc score)
        {
            fieldsToFetch.EnsureHasField(Constants.ReduceKeyFieldName);
            if (fieldsToFetch.HasExplicitFieldsToFetch)
            {
                return(base.RetrieveDocument(document, fieldsToFetch, score));
            }
            var field = document.GetField(Constants.ReduceValueFieldName);

            if (field == null)
            {
                fieldsToFetch = fieldsToFetch.CloneWith(document.GetFields().Select(x => x.Name).ToArray());
                return(base.RetrieveDocument(document, fieldsToFetch, score));
            }
            var projection = RavenJObject.Parse(field.StringValue);

            if (fieldsToFetch.FetchAllStoredFields)
            {
                var fields = new HashSet <string>(document.GetFields().Select(x => x.Name));
                fields.Remove(Constants.ReduceKeyFieldName);
                var documentFromFields = new RavenJObject();
                AddFieldsToDocument(document, fields, documentFromFields);
                foreach (var kvp in projection)
                {
                    documentFromFields[kvp.Key] = kvp.Value;
                }
                projection = documentFromFields;
            }
            return(new IndexQueryResult
            {
                Projection = projection,
                Score = score.Score,
                ReduceVal = field.StringValue
            });
        }
示例#2
0
 protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch, ScoreDoc score)
 {
     if (fieldsToFetch.IsProjection == false)
     {
         fieldsToFetch = fieldsToFetch.CloneWith(document.GetFields().Select(x => x.Name).ToArray());
     }
     fieldsToFetch.EnsureHasField(Constants.ReduceKeyFieldName);
     return(base.RetrieveDocument(document, fieldsToFetch, score));
 }
示例#3
0
 protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch)
 {
     if (fieldsToFetch.IsProjection == false)
     {
         fieldsToFetch = fieldsToFetch.CloneWith(document.GetFields().OfType <Fieldable>().Select(x => x.Name()).ToArray());
     }
     fieldsToFetch.EnsureHasField(Raven.Abstractions.Data.Constants.ReduceKeyFieldName);
     return(base.RetrieveDocument(document, fieldsToFetch));
 }
示例#4
0
        protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch, ScoreDoc score)
        {
            fieldsToFetch.EnsureHasField(Constants.ReduceKeyFieldName);
            if (fieldsToFetch.IsProjection)
            {
                return(base.RetrieveDocument(document, fieldsToFetch, score));
            }
            var field = document.GetField(Constants.ReduceValueFieldName);

            if (field == null)
            {
                fieldsToFetch = fieldsToFetch.CloneWith(document.GetFields().Select(x => x.Name).ToArray());
                return(base.RetrieveDocument(document, fieldsToFetch, score));
            }
            return(new IndexQueryResult
            {
                Projection = RavenJObject.Parse(field.StringValue),
                Score = score.Score
            });
        }
示例#5
0
		protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch, ScoreDoc score)
		{
			fieldsToFetch.EnsureHasField(Constants.ReduceKeyFieldName);
			if (fieldsToFetch.HasExplicitFieldsToFetch)
			{
				return base.RetrieveDocument(document, fieldsToFetch, score);
			}
			var field = document.GetField(Constants.ReduceValueFieldName);
			if (field == null)
			{
				fieldsToFetch = fieldsToFetch.CloneWith(document.GetFields().Select(x => x.Name).ToArray());
				return base.RetrieveDocument(document, fieldsToFetch, score);
			}
			return new IndexQueryResult
			{
				Projection = RavenJObject.Parse(field.StringValue),
				Score = score.Score
			};
		}
示例#6
0
		protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch, ScoreDoc score)
		{
			fieldsToFetch.EnsureHasField(Constants.ReduceKeyFieldName);
			if (fieldsToFetch.HasExplicitFieldsToFetch)
			{
				return base.RetrieveDocument(document, fieldsToFetch, score);
			}
			var field = document.GetField(Constants.ReduceValueFieldName);
			if (field == null)
			{
				fieldsToFetch = fieldsToFetch.CloneWith(document.GetFields().Select(x => x.Name).ToArray());
				return base.RetrieveDocument(document, fieldsToFetch, score);
			}
			var projection = RavenJObject.Parse(field.StringValue);
			if (fieldsToFetch.FetchAllStoredFields)
			{
				var fields = new HashSet<string>(document.GetFields().Select(x => x.Name));
				fields.Remove(Constants.ReduceKeyFieldName);
				var documentFromFields = new RavenJObject();
				AddFieldsToDocument(document, fields, documentFromFields);
				foreach (var kvp in projection)
				{
					documentFromFields[kvp.Key] = kvp.Value;
				}
				projection = documentFromFields;
			}
			return new IndexQueryResult
			{
				Projection = projection,
				Score = score.Score,
				ReduceVal = field.StringValue
			};
		}
示例#7
0
		protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch, float score)
		{
			if (fieldsToFetch.IsProjection == false)
				fieldsToFetch = fieldsToFetch.CloneWith(document.GetFields().OfType<Fieldable>().Select(x => x.Name()).ToArray());
			fieldsToFetch.EnsureHasField(Abstractions.Data.Constants.ReduceKeyFieldName);
			return base.RetrieveDocument(document, fieldsToFetch, score);
		}