I need to implement a search that will include elements from the
following documents (elements required are simplified. Search
parameters are listed):
Client (root)
ClientID
First Name (search parameter)
Last Name (search parameter)
Gender (search parameter. Value obtained from a lookup document)
ClientCase (root)
StartDate (search parameter. Current date within Start Date & EndDate
is returned as Active)
EndDate
Assessment
AssessmentID
Status(Value obtained from a lookup document)
*** Assessment is the core entity in connecting to the other
entities.There are multitple Assessment type documents that need to be
combined into the list.
Program (root)
ProgramID
The outputted list needs include all of the entity elements referenced
above. As mentioned above, there are multiple Assessment Types that
need to be combined in the list. Currently the Assessment classes do
not derive from a common base class.
I was able to combine two Assessment type classes using a MultiMap
techniqueas per:
http://ayende.com/blog/89089/ravendb-multi-maps-reduce-indexes
Still need to add in the other document elements and have be
searchable.
I have several best practices questions:
Is a MultiMap the technique that should be used as the core of the
index?
What is the best technique to connect the other entities?
Should the other entities be combined in Reduce of the multimap index
or in the query on the index?
Does anything specific need to be done with respect to the search
parameters?
For context, below is the current multimap
public class CaseProgramSummary_List :
AbstractMultiMapIndexCreationTask<CaseProgramSummaryDto>
{
public CaseProgramSummary_List()
{
AddMap<MapcAssessment>(assessments => from assessment in
assessments
select new
{
AssessmentId = assessment.Id,
});
AddMap<MfpAssessment>(assessments => from assessment in
assessments
select new
{
AssessmentId = assessment.Id,
});
Reduce = results => from result in results
group result by result.AssessmentId
into g
select new
{
AssessmentId = g.Key,
};
// Will need LastName property as analyzed, which means
that we can issue full text queries against it?
// Index(x => x.LastName, FieldIndexing.Analyzed);
}
}
var results = session.Query<CaseProgramSummaryDto,
CaseProgramSummary_List>()
// .Where(x => x.LastName.StartsWith("rah"))
.ToList();