public class Data_Index : AbstractIndexCreationTask<Data, Data_
Index.Result>
{
public class Result
{
public string Text { get; set; }
public int Year { get; set; }
public int? ProjectId { get; set; }
public int? CaseId { get; set; }
public int FilesCount { get; set; }
public string[] Files { get; set; }
}
public Data_
Index()
{
Map = data => from d in data
select new
{
Text = d.Text,
Year = d.Year,
ProjectId = d.ProjectId,
CaseId = d.CaseId,
FilesCount = d.Files.Count,
Files = d.Files.Select(x => x.Path).ToArray()
};
Index(x => x.Text, FieldIndexing.NotAnalyzed);
Index(x => x.Year, FieldIndexing.Default);
Index(x => x.ProjectId, FieldIndexing.Default);
Index(x => x.CaseId, FieldIndexing.Default);
Index(x => x.FilesCount, FieldIndexing.Default);
Index(x => x.Files, FieldIndexing.Default);
Sort(x => x.Text, SortOptions.String);
Sort(x => x.Year, SortOptions.Int);
Sort(x => x.ProjectId, SortOptions.Int);
Sort(x => x.CaseId, SortOptions.Int);
Sort(x => x.FilesCount, SortOptions.Int);
}
}
This is on the latest build of RavenDb running as a console application. I've tried to reproduce this issue on a embedded server running in memory but to no avail.
I'm considering denormalizing my data even further by extracting all documents with files to another collection but hesitant because I figure these queries should work without this much overhead.