private static ElasticGroupedTitleIndex AddNestedTitle(ElasticTitleIndex elasticTitleIndex,
                                                        ElasticGroupedTitleIndex elasticgrouptitleindex)
 {
     elasticgrouptitleindex.NestedTitle.Add(new NestedTitle
     {
         SourceItemId  = elasticTitleIndex.SourceItemId,
         Publisher     = elasticTitleIndex.Publisher,
         Awards        = elasticTitleIndex.Awards,
         ActivatedOn   = elasticTitleIndex.ActivatedOn,
         HasDrm        = elasticTitleIndex.HasDrm,
         MediaType     = elasticTitleIndex.MediaType,
         Isbn          = elasticTitleIndex.Isbn,
         ListPrice     = elasticTitleIndex.ListPrice,
         DiscountPrice = elasticTitleIndex.DiscountPrice,
         RetailPrice   = elasticTitleIndex.RetailPrice,
         Subscriptions = elasticTitleIndex.Subscriptions,
         Narrator      = elasticTitleIndex.Narrator,
         //Narrators = elasticTitleIndex.Narrators,
         Duration             = elasticTitleIndex.Duration,
         PublishedOn          = elasticTitleIndex.PublishedOn,
         Imprint              = elasticTitleIndex.Imprint,
         PreviewFile          = elasticTitleIndex.PreviewFile,
         SOP                  = elasticTitleIndex.SOP,
         SalesRights          = elasticTitleIndex.SalesRights,
         UsageTerms           = elasticTitleIndex.UsageTerms,
         Ownership            = elasticTitleIndex.Ownership,
         MediaCount           = elasticTitleIndex.MediaCount,
         StockLevel           = elasticTitleIndex.StockLevel,
         Review               = elasticTitleIndex.Review,
         Rating               = elasticTitleIndex.Rating,
         IsMarcAllowed        = elasticTitleIndex.IsMarcAllowed,
         Group                = elasticTitleIndex.Group,
         ProductLine          = elasticTitleIndex.ProductLine,
         Images               = elasticTitleIndex.Images,
         IsComingSoon         = elasticTitleIndex.IsComingSoon,
         HasImages            = elasticTitleIndex.HasImages,
         RecordingType        = elasticTitleIndex.RecordingType,
         MediaTypeDescription = elasticTitleIndex.MediaTypeDescription,
         ContentAdvisory      = elasticTitleIndex.ContentAdvisory,
         SeriesNo             = elasticTitleIndex.SeriesNo,
         Publishers           = new List <string>()
         {
             elasticTitleIndex.Publisher
         },
         MediaTypeBinding = elasticTitleIndex.MediaTypeBinding,
         Pricing          = elasticTitleIndex.Pricing,
         Bundle           = elasticTitleIndex.Bundle,
         IsExclusive      = elasticTitleIndex.IsExclusive
     });
     return(elasticgrouptitleindex);
 }
Example #2
0
        public static ElasticSuggestiveIndex MapSuggestive(this ElasticTitleIndex titleIndex)
        {
            var item = new ElasticSuggestiveIndex
            {
                Title = new Suggest()
                {
                    Input  = ParseTitle(titleIndex.Title),
                    Output = titleIndex.Title
                },
                Author        = titleIndex.Author,
                Genre         = titleIndex.Genres,
                Imprints      = titleIndex.Imprint,
                Narrator      = titleIndex.Narrator,
                Publisher     = DuplicatePublisherHashSet.Add(titleIndex.Publisher) ? titleIndex.Publisher : string.Empty,
                Series        = titleIndex.Series,
                UsageTerms    = titleIndex.UsageTerms,
                Subscriptions = titleIndex.Subscriptions,
                Sop           = titleIndex.SOP.Select(t => t.Name).ToList(),
                Keywords      = ParseKeywords(titleIndex.PopularKeywords)
            };

            return(item);
        }
Example #3
0
        public static ElasticTitleIndex Map(this TitleIndex titleindex)
        {
            var item = new ElasticTitleIndex
            {
                SalesRights             = titleindex.SalesRights,
                Title                   = titleindex.Title,
                Author                  = titleindex.Author,
                AuthorSort              = titleindex.AuthorSort,
                Audience                = titleindex.Audience,
                ActivatedOn             = titleindex.ActivatedOn,
                Duration                = titleindex.Duration,
                Genre                   = titleindex.Genre,
                Genres                  = titleindex.Genres,
                HasDrm                  = titleindex.HasDrm,
                Images                  = titleindex.Images,
                Isbn                    = titleindex.Isbn,
                IsFiction               = titleindex.IsFiction,
                ItemSubtitle            = titleindex.ItemSubtitle,
                Language                = titleindex.Language,
                MediaType               = titleindex.MediaType,
                Narrator                = titleindex.Narrator,
                NarratorSort            = titleindex.NarratorSort,
                PreviewFile             = titleindex.PreviewFile,
                PublishedOn             = titleindex.PublishedOn,
                Publisher               = titleindex.Publisher,
                Series                  = titleindex.Series,
                Series_Exact            = titleindex.Series,
                Imprint                 = titleindex.Imprint,
                ListPrice               = titleindex.ListPrice,
                Description             = titleindex.Description,
                Id                      = titleindex.Isbn,
                Subscriptions           = titleindex.Subscriptions,
                UsageTerms              = titleindex.UsageTerms,
                SOP                     = titleindex.SOP,
                MediaCount              = titleindex.MediaCount,
                StockLevel              = titleindex.StockLevel,
                SourceItemId            = titleindex.SourceItemId,
                Awards                  = titleindex.Awards,
                Review                  = titleindex.Review,
                Rating                  = titleindex.Rating,
                Group                   = titleindex.Group,
                Ownership               = titleindex.Ownership,
                IsMarcAllowed           = titleindex.IsMarcAllowed,
                ProductLine             = titleindex.ProductLine,
                IsComingSoon            = titleindex.IsComingSoon,
                RecordingType           = titleindex.RecordingType,
                MediaTypeDescription    = titleindex.MediaTypeDescription,
                ContentAdvisory         = titleindex.ContentAdvisory,
                HasImages               = titleindex.HasImages,
                Bundle                  = titleindex.Bundle,
                DiscountPrice           = titleindex.DiscountPrice,
                FullTitle               = titleindex.FullTitle,
                MediaTypeBinding        = titleindex.MediaTypeBinding,
                PopularKeywords         = titleindex.PopularKeywords,
                Pricing                 = titleindex.Pricing,
                Publishers              = titleindex.Publishers,
                RetailPrice             = titleindex.RetailPrice,
                SeriesNo                = titleindex.SeriesNo,
                SystemCirculationCopies = titleindex.SystemCirculationCopies,
                SystemHoldsCopies       = titleindex.SystemHoldsCopies,
                SystemTotalCopies       = titleindex.SystemTotalCopies,
                IsExclusive             = titleindex.IsExclusive
            };

            return(item);
        }
        public static ElasticGroupedTitleIndex MapGroup(this ElasticTitleIndex elasticTitleIndex)
        {
            //if no groupid set the groupid to a guid value
            string key = elasticTitleIndex.Group != null && elasticTitleIndex.Group.Id > 0 ? elasticTitleIndex.Group.Id.ToString() : Guid.NewGuid().ToString();
            ElasticGroupedTitleIndex elasticgrouptitleindex;

            if (Elastictitleindexstore.TryGetValue(key, out elasticgrouptitleindex))
            {
                return(AddNestedTitle(elasticTitleIndex, elasticgrouptitleindex));
            }
            var item = new ElasticGroupedTitleIndex
            {
                Id           = key,
                IsFiction    = elasticTitleIndex.IsFiction,
                Genre        = elasticTitleIndex.Genre,
                Genres       = elasticTitleIndex.Genres,
                Language     = elasticTitleIndex.Language,
                Author       = elasticTitleIndex.Author,
                AuthorSort   = elasticTitleIndex.AuthorSort,
                ItemSubtitle = elasticTitleIndex.ItemSubtitle,
                Title        = elasticTitleIndex.Title,
                Description  = elasticTitleIndex.Description,
                Audience     = elasticTitleIndex.Audience,
                Series       = elasticTitleIndex.Series,
                Series_Exact = elasticTitleIndex.Series_Exact,
                NestedTitle  = new List <NestedTitle>
                {
                    new NestedTitle()
                    {
                        Images        = elasticTitleIndex.Images,
                        ActivatedOn   = elasticTitleIndex.ActivatedOn,
                        HasDrm        = elasticTitleIndex.HasDrm,
                        MediaType     = elasticTitleIndex.MediaType,
                        Publisher     = elasticTitleIndex.Publisher,
                        Isbn          = elasticTitleIndex.Isbn,
                        ListPrice     = elasticTitleIndex.ListPrice,
                        DiscountPrice = elasticTitleIndex.DiscountPrice,
                        RetailPrice   = elasticTitleIndex.RetailPrice,
                        Subscriptions = elasticTitleIndex.Subscriptions,
                        Narrator      = elasticTitleIndex.Narrator,
                        //Narratorsort = elasticTitleIndex.Narrators,
                        Duration             = elasticTitleIndex.Duration,
                        PublishedOn          = elasticTitleIndex.PublishedOn,
                        Imprint              = elasticTitleIndex.Imprint,
                        PreviewFile          = elasticTitleIndex.PreviewFile,
                        SOP                  = elasticTitleIndex.SOP,
                        SalesRights          = elasticTitleIndex.SalesRights,
                        UsageTerms           = elasticTitleIndex.UsageTerms,
                        Awards               = elasticTitleIndex.Awards,
                        SourceItemId         = elasticTitleIndex.SourceItemId,
                        Group                = elasticTitleIndex.Group,
                        Ownership            = elasticTitleIndex.Ownership,
                        MediaCount           = elasticTitleIndex.MediaCount,
                        StockLevel           = elasticTitleIndex.StockLevel,
                        Review               = elasticTitleIndex.Review,
                        Rating               = elasticTitleIndex.Rating,
                        IsMarcAllowed        = elasticTitleIndex.IsMarcAllowed,
                        ProductLine          = elasticTitleIndex.ProductLine,
                        IsComingSoon         = elasticTitleIndex.IsComingSoon,
                        RecordingType        = elasticTitleIndex.RecordingType,
                        MediaTypeDescription = elasticTitleIndex.MediaTypeDescription,
                        ContentAdvisory      = elasticTitleIndex.ContentAdvisory,
                        HasImages            = elasticTitleIndex.HasImages,
                        SeriesNo             = elasticTitleIndex.SeriesNo,
                        Publishers           = new List <string>()
                        {
                            elasticTitleIndex.Publisher
                        },
                        MediaTypeBinding = elasticTitleIndex.MediaTypeBinding,
                        Pricing          = elasticTitleIndex.Pricing,
                        Bundle           = elasticTitleIndex.Bundle,
                        IsExclusive      = elasticTitleIndex.IsExclusive
                    }
                }
            };

            Elastictitleindexstore.Add(key, item);
            return(item);
        }
Example #5
0
 public ElasticTitleIndex Post(ElasticTitleIndex t)
 {
     ElasticSearch.Index(t);
     return(t);
 }