Ejemplo n.º 1
0
        public void Process()
        {
            if (HasTitle)
            {
                TitleIndex = new PositionalIndex();
            }

            ContentIndex = new PositionalIndex();

            var pureDocs = Documents.Values.Select(x => x.Document).ToList();

            Dictionary <int, DocumentTokens> titleTokensBulk = null;

            if (HasTitle)
            {
                var titlePreprocessClient = new PreprocessClient(true, true);
                titleTokensBulk = titlePreprocessClient.GetTokens(pureDocs).ToDictionary(x => x.DocumentId);
            }

            var contentPreprocessClient = new PreprocessClient(false, true);
            var contentTokensBulk       = contentPreprocessClient.GetTokens(pureDocs).ToDictionary(x => x.DocumentId);


            foreach (var docId in contentTokensBulk.Keys.OrderBy(x => x))
            {
                if (HasTitle)
                {
                    TitleIndex.AddDocumentToIndex(titleTokensBulk[docId]);
                }

                ContentIndex.AddDocumentToIndex(contentTokensBulk[docId]);

                if (HasTitle)
                {
                    Documents[docId].SetTokens(titleTokensBulk[docId], contentTokensBulk[docId]);
                }
                else
                {
                    Documents[docId].SetTokens(null, contentTokensBulk[docId]);
                }
            }

            foreach (var document in Documents.Values)
            {
                document.CreateVector(TitleIndex, ContentIndex);
            }
        }
        public static ElasticOwnershipIndexCollection MapOwnership(this TitleIndex titleindex)
        {
            var item = new ElasticOwnershipIndexCollection
            {
                Isbn             = titleindex.Isbn,
                ElasticOwnership = titleindex.Ownership.Select(t => new ElasticOwnershipIndex()
                {
                    TotalCopies       = t.TotalCopies,
                    CirculationCopies = t.CirculationCopies,
                    HoldsCopies       = t.HoldsCopies,
                    HoldsRatio        = t.HoldsRatio,
                    ScopeId           = t.ScopeId,
                    Subscriptions     = t.Subscriptions,
                    Sop         = t.Sop,
                    Expirations = t.Expirations,
                }).ToList()
            };

            return(item);
        }
Ejemplo n.º 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 void Dispose()
 {
     IdIndex.Dispose();
     TitleIndex.Dispose();
     TracksSubfingerprintsIndex.Dispose();
 }