private static void StoreItems(Engine engine, IEnumerable<MovieCategory> items) { foreach (MovieCategory itemVal in items) { MovieCategory movieCategory = itemVal; engine.WithSession(session => { session.Store(movieCategory); session.SaveChanges(); }); } }
private static List<MovieCategory> Search(Engine engine, string query) { List<MovieCategory> movieCategories = null; engine.WithSession(session => { movieCategories = session.Advanced.LuceneQuery<MovieCategory, CategoryAndMoviesIndex>() .Search(x => x.Name, query) .Search(x => x.Movies.Select(y => y.Name), query) .WaitForNonStaleResults() .ToList(); }); return movieCategories; }