Dynamic index - Passing parameters to inherited AbstractIndexCreationTask object

61 views
Skip to first unread message

John

unread,
May 7, 2012, 12:36:44 PM5/7/12
to ravendb
How will I pass parameters into this object so that I wanted to build
the "maps" string dynamically based on the paramters.

public class RavenDynamicIndex: AbstractIndexCreationTask
{

public RavenDynamicIndex()
{

}


public override IndexDefinition CreateIndexDefinition()
{

var maps = new HashSet<string>();

maps.Add(@"docs.Rolls.SelectMany(x => (x.RollIndexList),
(x, d) => new {DocumentType = d.Index.DocumentType})");


return new IndexDefinition
{
Name = "TestingDynamicIndex",
Maps = maps,
Reduce = "results.GroupBy(r => new {DocumentType =
r.DocumentType}).Select(g => new {DocumentType =
g.Key.DocumentType})"
};
}
}

Oren Eini (Ayende Rahien)

unread,
May 7, 2012, 12:54:36 PM5/7/12
to rav...@googlegroups.com
A constructor parameter? I am not sure that I am following what you mean here.
Note that if you are building indexes like that, you might as well just skip the AbstractIndexCreationTask
Reply all
Reply to author
Forward
0 new messages