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 }); }
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)); }
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)); }
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 }); }
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 }; }
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 }; }
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); }