I have to go with multimap, as this is a requirement based on user search in my application. but I am not sure abt hw to write the Multi map. this my code, , not fully complete.
/// <summary>
/// The class that defines an index for doing full text search in the users.
/// </summary>
public class UserSearchIndexNew : AbstractIndexCreationTask<User, UserSearchIndexNew.Result>
{
/// <summary>
/// The class that maps the fields in Users document for doing a full text search.
/// </summary>
public class Result
{
/// <summary>
/// Gets or sets the query for the index for searching the users.
/// </summary>
public string Query { get; set; }
/// <summary>
/// Gets or sets the Id of the user related to.
/// </summary>
public string Id { get; set; }
/// <summary>
/// Gets or sets the Id of the customer the user related to.
/// </summary>
public string CustomerId { get; set; }
/// <summary>
/// Gets or sets the Portfolio.
/// </summary>
public string Portfolio { get; set; }
/// <summary>
/// Gets or sets the Role.
/// </summary>
public RoleType Role { get; set; }
/// <summary>
/// Gets or sets the User Status.
/// </summary>
public UserStatus UserStatus { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the Active status.
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets or sets the PortfolioData.
/// </summary>
public PortfolioData UserPortfolio { get; set; }
/// <summary>
/// Gets or sets the PortfolioData.
/// </summary>
public Portfolio UserPortfolioTitle { get; set; }
}
/// <summary>
/// Initializes a new instance of the UserSearchIndexNew class.
/// </summary>
public UserSearchIndexNew()
select new
{
user.FirstName,
user.LastName,
user.EMailAddress,
user.Id,
user.CustomerId,
user.CreatedDate,
Role = user.Roles.Select(x => x.Type),
Portfolio = user.Portfolios.Select(x => x.Id),
UserPortfolio = user.Portfolios,
UserStatus = user.UserStatus,
Active = user.Active
};
this.Map = portfolios => from portfolio in portfolios
select new
{
portfolio.Title
};
}
}