public TaskSummaryIndex() { Map = docs => from t in docs select new { t.Start }; TransformResults = (database, results) => from result in results let giver = database.Load <Raven.Tests.Bugs.LiveProjections.Entities.User>("users/" + result.GiverId) let taker = database.Load <Raven.Tests.Bugs.LiveProjections.Entities.User>("users/" + result.TakerId) let place = database.Load <Place>("places/" + result.PlaceId) select new { Id = result.Id, Description = result.Description, Start = result.Start, End = result.End, GiverId = result.GiverId, GiverName = giver.Name, TakerId = result.TakerId, TakerName = taker != null ? taker.Name : null, PlaceId = result.PlaceId, PlaceName = place.Name }; SortOptions.Add(s => s.Start, Raven.Abstractions.Indexing.SortOptions.String); }
/// <summary> /// The constructor for the class /// </summary> public SettingsViewModel() { foreach (string i in AppSettings.OrderOptions) { SortOptions.Add(i); } DeleteAllNotesCommand = new Command(async() => await DeleteAllNotes()); }
public ContentWithCommentsCount() { Map = comments => from item in comments select new { ContentId = item.Content.Id, Count = 1 }; Reduce = reduce => from item in reduce group item by item.ContentId into g select new { ContentId = g.Key, Count = g.Sum(item => item.Count) }; SortOptions.Add(x => x.Count, Raven.Database.Indexing.SortOptions.Int); }
public RssFeedsWithItemsCount() { Map = rssItems => from item in rssItems where item.ContentType == ContentType.RssItem select new { FeedId = item.RssFeed.Id, Count = 1 }; Reduce = reduce => from item in reduce group item by item.FeedId into g select new { FeedId = g.Key, Count = g.Sum(item => item.Count) }; SortOptions.Add(x => x.Count, Raven.Database.Indexing.SortOptions.Int); }
/// <summary> /// Register a field to be sorted /// </summary> protected void Sort(Expression <Func <TReduceResult, object> > field, SortOptions sort) { SortOptions.Add(field, sort); }
public void AddSort(string propertyName, string sortOrder) { SortOptions.Add(new SortOption(propertyName, sortOrder == "descending" ? SortOrder.Descending : SortOrder.Ascending)); }
public void AddSort(string propertyName, SortOrder sortOrder) { SortOptions.Add(new SortOption(propertyName, sortOrder)); }