CloneWith() public method

public CloneWith ( string newFieldsToFetch ) : FieldsToFetch
newFieldsToFetch string
return FieldsToFetch
Ejemplo n.º 1
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));
 }
Ejemplo n.º 2
0
 protected override IndexQueryResult RetrieveDocument(Document document, FieldsToFetch fieldsToFetch, float 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));
 }
Ejemplo n.º 3
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
            });
        }
Ejemplo n.º 4
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
			};
		}
Ejemplo n.º 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);
			}
			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
			};
		}
Ejemplo n.º 6
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);
		}