Skip to content

Instantly share code, notes, and snippets.

@felipeleusin
Created May 5, 2012 13:44
Show Gist options
  • Save felipeleusin/2602559 to your computer and use it in GitHub Desktop.
Save felipeleusin/2602559 to your computer and use it in GitHub Desktop.
Raven MoreLikeThis Not working
public class UserProfile
{
public string Id { get; set; }
public string Name { get; set; }
public string Hometown { get; set; }
public DateTime FromDate { get; set; }
public DateTime ToDate { get; set; }
public string Neighbourhood { get; set; }
public string TravellingWith { get; set; }
public List<string> Interests { get; set; }
public UserProfile()
{
Interests = new List<string>();
}
}
public class UserProfileIndex : AbstractIndexCreationTask<UserProfile>
{
public UserProfileIndex()
{
Map = profiles => from profile in profiles
select new
{
profile.ToDate,
profile.FromDate,
profile.Hometown,
profile.Neighbourhood,
profile.TravellingWith,
profile.Interests
};
Stores = new Dictionary<Expression<Func<UserProfile, object>>, FieldStorage>()
{
{
x => x.ToDate, FieldStorage.Yes
},
{
x => x.FromDate, FieldStorage.Yes
},
{
x => x.Hometown, FieldStorage.Yes
},
{
x => x.Neighbourhood, FieldStorage.Yes
},
{
x => x.TravellingWith, FieldStorage.Yes
},
{
x => x.Interests, FieldStorage.Yes
}
};
Index(x => x.ToDate, FieldIndexing.Analyzed);
Index(x => x.FromDate, FieldIndexing.Analyzed);
Index(x => x.Hometown, FieldIndexing.Analyzed);
Index(x => x.Neighbourhood, FieldIndexing.Analyzed);
Index(x => x.TravellingWith, FieldIndexing.Analyzed);
Index(x => x.Interests, FieldIndexing.Analyzed);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment