Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9105295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:04:27+00:00 2026-06-17T02:04:27+00:00

I am implementing Sitecore Item Buckets into my project for Sitecore 6.4, .NET 2.0.

  • 0

I am implementing Sitecore Item Buckets into my project for Sitecore 6.4, .NET 2.0.

I have everything installed and all appears to be working correctly. I created an item bucket and a bucketable template. The Search UI works perfectly in Content Editor queries. I can also query the index for my items in both Sitecore Index Viewer as well as the Sitecore Rocks Index utility.

However when I try to implement the UI in code, I can never get any results no matter what method I try. I keep getting null back for every type of query I try to run. I’ve tried BucketManager, Search extension method, and BucketQuery all to no avail.

I also have Debug logging turned on and when I search in Content Editor via the Search tab I see logging for the query, but when my code executes no log entries are generated whatsoever. Does anyone have an idea of why this may be happening. More than happy to provide more information to try and track this down.

Item root = MasterDatabase.GetItem(Constants.ARI_BUCKET_LOCATION_ID); 

var items = root.Search(out hitCount, 
text: "*", 
indexName: "itembuckets_buckets", 
location: root.ID.ToString(), 
language: "en", 
startDate: "01/01/2013", 
endDate: "12/31/2013", 
numberOfItemsToReturn: 100, 
pageNumber: 1, 
templates: tmpInventoryRate.ID.ToString()); 

var itemresults = root.Search(out hitCount, numberOfItemsToReturn: 100, language: "en"); 

var results = BucketManager.Search(root, out hitCount, templates: tmpInventoryRate.ID.ToString()); 

var textresults = BucketManager.Search(MasterDatabase.GetItem(Constants.ARI_BUCKET_LOCATION_PATH), out hitCount, text: "OEH", location: root.ID.ToString()); 

var pathresults = BucketManager.Search(MasterDatabase.GetItem(Constants.ARI_BUCKET_LOCATION_PATH), out hitCount, templates: tmpInventoryRate.ID.ToString()); 

var queryresults = new BucketQuery().WhereTemplateIs("*").Run(root, 100); 

One thing to note that I am curious about is that the above code executes in a DAL module that does not have access to Sitecore.Context but the MasterDatabase.GetItem() call does in fact retrieve the Item from the master database, but I don’t know if somewhere in the Bucket API code Context is being referenced potentially?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:04:29+00:00Added an answer on June 17, 2026 at 2:04 am

    OK, so after posting I followed down the path of my last comment about Context and using Reflector to dig into the Sitecore.ItemBucket.Kernel.Util.IndexSearcher and Sitecore.ItemBucket.Kernel.Managers.BucketManager classes I saw that both indeed references the Context item.
    Part of my problem was I started with the Item Buckets on a server side processing script that was not part of the Sitecore content tree, therefore doesn’t go through the processing pipeline, so that is why I did not have Context available during execution.

    Buried in the answers here I found the way to set current context programatically from web.config <site> setting: Set Active Site as Context

    Using that I then used the following using block to set the desired site as current Context like so:

                int hitCount;
                Item root = MasterDatabase.GetItem(Constants.ARI_BUCKET_LOCATION_ID);
    
                using (new SecurityDisabler())
                {
                    Sitecore.Context.SetActiveSite("website"); //Set Current Context
                    var items = root.Search(out hitCount,
                                        text: "*",
                                        indexName: "itembuckets_buckets",
                                        location: root.ID.ToString(),
                                        language: "en",
                                        startDate: "01/01/2013",
                                        endDate: "12/31/2013",
                                        numberOfItemsToReturn: 100,
                                        pageNumber: 1,
                                        templates: "{3B0476F4-C3C4-43DD-8490-2B3FF67C368B}");
                }
    

    After making this change, I received my bucket items as expected!!

    SIDE NOTE: Also just as a note for anyone who may be going down the same path following the code examples that was unrelated to this issue but something I came across while following the code samples. Make sure you have your <site name='website' ... content='master' > setting set properly in you web.config to use the Sitecore.Context.ContentDatabase.GetItem() methods as used in the developer guide and I also saw some references in the Searcher class that referenced Context.ContentDatabase as well.

    Hope this saves someone else a little more time than it took me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Sitecore 6.1.0 installation I have hooked onto the item:added event by implementing
implementing this on MATLAB for my project. I have a circle divided up to
I'm implementing a custom field in Sitecore for the Content Editor, and I need
Implementing a simple Login screen using JSF and Spring and Hibernate. I have written
Implementing a GIT repository for a project we are including the DB structure by
In implementing M-V-VM in a project and following advice of Karl Shifflett about implementing
Implementing slides.js on our site, I seem to have somehow caused the actual sliding
Implementing page not found in django and have looked at the documentation 404 I
Whilst implementing the use of ODP.Net in our apps I came across a potential
Implementing an app where the user can log in I have the following situation:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.