コード例 #1
0
 public long RunWhereItemEnumerable()
 {
     using (var queryTimer = new QueryTimer())
     {
         var run = Sitecore.Context.Database.GetItem(Sitecore.ItemIDs.RootID).Axes.GetDescendants().Where(item => item.TemplateName == "Sample Item").Take(20);
         foreach (var item in run)
         {
         }
         return(queryTimer.StopWatch.ElapsedTicks / 1000);
     }
 }
コード例 #2
0
 public long RunWhereQuery()
 {
     using (var queryTimer = new QueryTimer())
     {
         var run = Sitecore.Context.Database.SelectItems("/sitecore//*[@@templatename = 'Sample Item']");
         foreach (var item in run)
         {
         }
         return(queryTimer.StopWatch.ElapsedTicks / 1000);
     }
 }
コード例 #3
0
 public long RunWhereItemEnumerable5()
 {
     using (var queryTimer = new QueryTimer())
     {
         var run = Sitecore.Context.Database.GetItem("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}").Axes.GetAncestors().Take(20);
         foreach (var item in run)
         {
         }
         return(queryTimer.StopWatch.ElapsedTicks / 1000);
     }
 }
コード例 #4
0
 public long RunWhereItemEnumerable6()
 {
     using (var queryTimer = new QueryTimer())
     {
         var run = Sitecore.Context.Database.GetItem(Sitecore.ItemIDs.RootID).Axes.GetDescendants().Where(item => item.Statistics.Created > DateTime.Now.AddDays((-100))).Take(20);
         foreach (var item in run)
         {
         }
         return(queryTimer.StopWatch.ElapsedTicks / 1000);
     }
 }
コード例 #5
0
        public long RunWhereFastQuery4()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("fast:/sitecore//*").Take(20);
                foreach (var item in run)
                {
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #6
0
        public long RunWhereFastQuery5()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("fast:/sitecore/system/Settings/Buckets/Search Types/Author/ancestor::*").Take(20);
                foreach (var item in run)
                {
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #7
0
        public long RunWhereLinq6()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var run = context.GetQueryable <SearchResultItem>().Where(item => item.CreatedDate > DateTime.Now.AddDays(-100)).Take(20).ToList();
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #8
0
        public long RunWhereLinq2()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var run = context.GetQueryable <SearchResultItem>().Where(item => item.TemplateName.Contains("Sam")).Take(20).ToList();
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #9
0
        public long RunWhereQuery6()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("/sitecore//*[@__Updated >= '20090101']").Take(20);
                foreach (var item in run)
                {
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #10
0
        public long RunWhereFastQuery5()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("fast:/sitecore/system/Settings/Buckets/Search Types/Author/ancestor::*").Take(20);
                foreach (var item in run)
                {

                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #11
0
        public long RunWhereFastQuery4()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("fast:/sitecore//*").Take(20);
                foreach (var item in run)
                {

                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #12
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    TermQuery  ftQuery = new TermQuery(new Term("_templatename", "sample item"));
                    SearchHits results = context.Search(ftQuery);
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #13
0
        public long RunWhereFastQuery3()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("fast:/sitecore/*[@@templatename = 'Sample Item']");
                foreach (var item in run)
                {

                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #14
0
        public long RunWhereLinq5()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var id1     = IdHelper.NormalizeGuid("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}");
                    var results = context.GetQueryable <ExtendedSearchResultItem>().Where(i => i["_group"] == id1);
                    results.First().GetAncestors <SearchResultItem>(context).Take(20);
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #15
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager6()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    var            id1     = IdHelper.NormalizeGuid("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}");
                    TermRangeQuery ftQuery = new TermRangeQuery("__updated", "20090101", "20130505", true, true);
                    SearchHits     results = context.Search(ftQuery);
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #16
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager5()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    var        id1     = IdHelper.NormalizeGuid("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}");
                    TermQuery  ftQuery = new TermQuery(new Term("_path", id1));
                    SearchHits results = context.Search(ftQuery);
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #17
0
        public long RunWhereLinq3()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var id1     = IdHelper.NormalizeGuid(Sitecore.ItemIDs.RootID);
                    var results = context.GetQueryable <ExtendedSearchResultItem>().Where(i => i["_group"] == id1);
                    results.First().GetChildren <SearchResultItem>(context).Where(template => template.TemplateName == "Sample Item");
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #18
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager3()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    var        id1     = IdHelper.NormalizeGuid(Sitecore.ItemIDs.RootID);
                    TermQuery  ftQuery = new TermQuery(new Term("_parent", id1));
                    SearchHits results = context.Search(ftQuery);
                }

                return(queryTimer.StopWatch.ElapsedTicks / 1000);
            }
        }
コード例 #19
0
        public long RunWhereLinq4()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var id1 = IdHelper.NormalizeGuid(Sitecore.ItemIDs.RootID);
                    var results = context.GetQueryable<ExtendedSearchResultItem>().Where(i => i["_group"] == id1);
                    results.First().GetDescendants<SearchResultItem>(context).Take(20);
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #20
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager6()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    var id1 = IdHelper.NormalizeGuid("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}");
                    TermRangeQuery ftQuery = new TermRangeQuery("__updated", "20090101", "20130505", true, true);
                    SearchHits results = context.Search(ftQuery);
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #21
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager5()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    var id1 = IdHelper.NormalizeGuid("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}");
                    TermQuery ftQuery = new TermQuery(new Term("_path", id1));
                    SearchHits results = context.Search(ftQuery);
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #22
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager4()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    var id1 = IdHelper.NormalizeGuid(Sitecore.ItemIDs.RootID);
                    TermQuery ftQuery = new TermQuery(new Term("_path", id1));
                    SearchHits results = context.Search(ftQuery);
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #23
0
        //NOTE: This required me to bring in the Lucene.Net Reference
        public long RunWhereSearchManager2()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = SearchManager.GetIndex("system").CreateSearchContext())
                {
                    WildcardQuery ftQuery = new WildcardQuery(new Term("_templatename", "*sam*"));
                    SearchHits results = context.Search(ftQuery);
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #24
0
        public long RunWhereQuery6()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("/sitecore//*[@__Updated >= '20090101']").Take(20);
                foreach (var item in run)
                {

                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #25
0
        public long RunWhereQuery2()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.SelectItems("/sitecore//*[contains(@@templatename, 'Sam')]");
                foreach (var item in run)
                {

                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #26
0
        public long RunWhereLinq6()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var run = context.GetQueryable<SearchResultItem>().Where(item => item.CreatedDate > DateTime.Now.AddDays(-100)).Take(20).ToList();
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #27
0
        public long RunWhereItemEnumerable3()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.GetItem(Sitecore.ItemIDs.RootID).GetChildren().Where(item => item.TemplateName == "Sample Item");
                foreach (var item in run)
                {

                }
                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #28
0
        public long RunWhereLinq2()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var run = context.GetQueryable<SearchResultItem>().Where(item => item.TemplateName.Contains("Sam")).Take(20).ToList();
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #29
0
        public long RunWhereItemEnumerable6()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.GetItem(Sitecore.ItemIDs.RootID).Axes.GetDescendants().Where(item => item.Statistics.Created > DateTime.Now.AddDays((-100))).Take(20);
                foreach (var item in run)
                {

                }
                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #30
0
        public long RunWhereItemEnumerable5()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.GetItem("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}").Axes.GetAncestors().Take(20);
                foreach (var item in run)
                {

                }
                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #31
0
        public long RunWhereItemEnumerable4()
        {
            using (var queryTimer = new QueryTimer())
            {
                var run = Sitecore.Context.Database.GetItem(Sitecore.ItemIDs.RootID).Axes.GetDescendants().Take(20);
                foreach (var item in run)
                {

                }
                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }
コード例 #32
0
        public long RunWhereLinq5()
        {
            using (var queryTimer = new QueryTimer())
            {
                using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
                {
                    var id1 = IdHelper.NormalizeGuid("{16156647-DE5D-4E6A-A6AE-5B8D4A3A40BE}");
                    var results = context.GetQueryable<ExtendedSearchResultItem>().Where(i => i["_group"] == id1);
                    results.First().GetAncestors<SearchResultItem>(context).Take(20);
                }

                return queryTimer.StopWatch.ElapsedTicks / 1000;
            }
        }