Skip to content

Instantly share code, notes, and snippets.

@ja1984
Created March 2, 2012 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ja1984/1956460 to your computer and use it in GitHub Desktop.
Save ja1984/1956460 to your computer and use it in GitHub Desktop.
Hotdeals ravendb
public class HotDeals_Search : AbstractIndexCreationTask<Cruise, RavenHotDeal>
{
public HotDeals_Search()
{
Map = docs => from doc in docs
from sailDate in doc.ItinerarySailDates.DefaultIfEmpty()
where sailDate.Prices.Count() > 0
select new
{
doc.Description,
doc.Brand,
doc.Currency,
doc.Nights,
doc.ShipCode,
sailDate.SailDate,
doc.GeoCode,
doc.PortCode,
doc.PackageCode,
doc.SortPrice,
doc.SortPrice1Passenger,
doc.SortPrice2Passenger,
doc.SortPrice3Passenger,
doc.SortPrice4Passenger,
//ItinerarySailDate = sailDate
};
Store(x => x.PackageCode, FieldStorage.Yes);
Store(x => x.GeoCode, FieldStorage.Yes);
Store(x => x.Nights, FieldStorage.Yes);
Store(x => x.PortCode, FieldStorage.Yes);
Store(x => x.SailDate, FieldStorage.Yes);
Store(x => x.ShipCode, FieldStorage.Yes);
Store(x => x.SortPrice1Passenger, FieldStorage.Yes);
Store(x => x.SortPrice2Passenger, FieldStorage.Yes);
Store(x => x.SortPrice3Passenger, FieldStorage.Yes);
Store(x => x.SortPrice4Passenger, FieldStorage.Yes);
Sort(x => x.Nights, global::Raven.Abstractions.Indexing.SortOptions.Int);
Sort(x => x.SortPrice1Passenger, global::Raven.Abstractions.Indexing.SortOptions.Int);
Sort(x => x.SortPrice2Passenger, global::Raven.Abstractions.Indexing.SortOptions.Int);
Sort(x => x.SortPrice3Passenger, global::Raven.Abstractions.Indexing.SortOptions.Int);
Sort(x => x.SortPrice4Passenger, global::Raven.Abstractions.Indexing.SortOptions.Int);
}
}
public class RavenHotDeal
{
public string Description { get; set; }
public int Brand { get; set; }
public string Currency { get; set; }
public int Nights { get; set; }
public string ShipCode { get; set; }
public DateTime SailDate { get; set; }
public string GeoCode { get; set; }
public string PortCode { get; set; }
public string PackageCode { get; set; }
public ItinerarySailDate ItinerarySailDate { get; set; }
public decimal SingleTravelerFromPrice { get; set; }
public decimal SortPrice1Passenger { get; set; }
public decimal SortPrice2Passenger { get; set; }
public decimal SortPrice3Passenger { get; set; }
public decimal SortPrice4Passenger { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment