I have a 3-column table Id, Title, Section.
- I want a unique value from the title column. ( which I fetch by Map Reduce index)
- Now the user will select Title from the dropdown then want to fetch the Unique section which will match by Title (How to fetch unique section which match Title. I use Distinct but performance get down)
- Then the user will select the Section where I want to fetch Unique Title by matching the title and section
My Index
class UniqueActIndex : AbstractIndexCreationTask<ActRuleModel, UniqueActIndex.Result> {
public class Result {
public string ActTitle { get; set; }
}
public UniqueActIndex() {
Map = orders => from o in orders
select new Result {
ActTitle = Regex.Replace(o.ActTitle, @"[^0-9a-zA-Z]+", " ")
};
Reduce = results => from r in results
group r by r.ActTitle into g
select new Result {
ActTitle = g.Key
};
}
}
}