Пример #1
0
        internal static SyndicationFeed GetUnprocessedQueueItems(string namedIndexingService, int pageSize, out System.Collections.ObjectModel.Collection <Identity> ids)
        {
            SyndicationFeed syndicationFeed = new SyndicationFeed();

            System.Collections.Generic.List <SyndicationItem> list = new System.Collections.Generic.List <SyndicationItem>();
            ids = new System.Collections.ObjectModel.Collection <Identity>();
            IQueryable <IndexRequestQueueItem> queryable = (
                from queueItem in SearchSettings.GetDynamicDataStore().Items <IndexRequestQueueItem>()
                where queueItem.NamedIndexingService == namedIndexingService
                orderby queueItem.Timestamp
                select queueItem).Take(pageSize);

            foreach (IndexRequestQueueItem current in queryable)
            {
                list.Add(SearchFactory.ConstructSyndicationItem(current));
                ids.Add(current.Id);
            }
            System.Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            string         value   = string.Format(System.Globalization.CultureInfo.InvariantCulture, "EPiServer.Search v.{0}.{1}.{2}.{3}", new object[]
            {
                version.Major.ToString(System.Globalization.CultureInfo.InvariantCulture),
                version.Minor.ToString(System.Globalization.CultureInfo.InvariantCulture),
                version.Build.ToString(System.Globalization.CultureInfo.InvariantCulture),
                version.Revision.ToString(System.Globalization.CultureInfo.InvariantCulture)
            });

            syndicationFeed.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameVersion, SearchSettings.Config.XmlQualifiedNamespace), value);
            syndicationFeed.Items = list;
            return(syndicationFeed);
        }
Пример #2
0
 internal static void RemoveProcessedQueueItems(System.Collections.ObjectModel.Collection <Identity> ids)
 {
     using (DynamicDataStore dynamicDataStore = SearchSettings.GetDynamicDataStore())
     {
         foreach (Identity current in ids)
         {
             dynamicDataStore.Delete(current);
         }
     }
 }
Пример #3
0
        protected void ReIndex_Click(object sender, EventArgs e)
        {
            var contentSearchHandler = ServiceLocator.Current.GetInstance <LuceneContentSearchHandler>();

            contentSearchHandler.ReIndex();
            this.ReIndex.Enabled = false;
            var totalItems = SearchSettings.GetDynamicDataStore().Items().Count();

            this.TotalItems.Text = string.Format("Starting...<br/>Total item(s): {0}", totalItems);
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "runindex", string.Format("initialIndexRequestCount = {0}; GetIndexingStatus();", totalItems), true);
        }
Пример #4
0
        internal static void AddToQueue(IndexRequestItem item, string namedIndexingService)
        {
            if (string.IsNullOrEmpty(namedIndexingService))
            {
                namedIndexingService = SearchSettings.Config.NamedIndexingServices.DefaultService;
            }

            SearchSettings.GetDynamicDataStore().Save(new IndexRequestQueueItem
            {
                IndexItemId          = item.Id,
                NamedIndex           = item.NamedIndex,
                NamedIndexingService = namedIndexingService,
                SyndicationItemXml   = item.ToSyndicationItemXml(),
                Timestamp            = System.DateTime.Now
            });
        }
Пример #5
0
        internal static void TruncateQueue(string namedIndexingService, string namedIndex)
        {
            IQueryable <IndexRequestQueueItem> queryable = null;
            string namedService = (!string.IsNullOrEmpty(namedIndexingService)) ? namedIndexingService : SearchSettings.Config.NamedIndexingServices.DefaultService;

            do
            {
                queryable = (
                    from queueItem in SearchSettings.GetDynamicDataStore().Items <IndexRequestQueueItem>()
                    where queueItem.NamedIndexingService == namedService && queueItem.NamedIndex == namedIndex
                    select queueItem).Take(100);
                foreach (IndexRequestQueueItem current in queryable.ToList <IndexRequestQueueItem>())
                {
                    SearchSettings.GetDynamicDataStore().Delete(current.Id);
                }
            }while (queryable != null && queryable.Count <IndexRequestQueueItem>() != 0);
        }
Пример #6
0
 internal static void TruncateQueue()
 {
     SearchSettings.GetDynamicDataStore().DeleteAll();
 }
Пример #7
0
 protected void ClearIndexDataStoreClick(object sender, EventArgs e)
 {
     SearchSettings.GetDynamicDataStore().DeleteAll();
     this.ReIndex.Enabled = true;
 }