9

How do I figure out whether or not an item is indexed properly? Indexing depends on which tables in the Sitecore DBs?

When I search for an item in the search field, I am not able to fetch the item. However, when when I moved through the folders in the Content Tree, I can see the item.

The item is properly published and it is available in both the master and web DBs.

1
  • If you are using Lucene, you can use lukeall app to see if the item is present into the index and if it is solr, you can perform query on the Solr Server Jul 24, 2017 at 7:48

4 Answers 4

2

In addition to Diegos answer, I would like to mention the "LinqScratchPad.aspx", that ships with Sitecore 7 and above.

You can find in under http://yourdomain.com/sitecore/admin/LinqScratchPad.aspx. You can use it to query your indexes by writing C# code. The following code is based on the sample code, that comes with the page, that should show all items with a specific path. If the result does not list your item, it's not part of the index.

/* 
    keep the standard usings, 
    that comes with the sample code,
    to make this code work 
*/
namespace Test 
{
    class Program 
    {
        public static IEnumerable<SearchResultItem> Main(string str)
        {
            using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
            {
                return context.GetQueryable<SearchResultItem>()
                  .Where(n=>n.Path=="/path/to/your/item").ToList();
            }
        }
    }
}

I thought it's good to have a tool mentioned here, that comes out-of-the-box with Sitecore. There are environments where you have a hard time installing third-party software.

2

It depends what search technologies you are using.

Lucene: As mentioned you can use Luke or the Index Viewer tool which comes with Sitecore powershell extensions module. The Index Viewer comes in a separate package (check the downloads section and look for the Authorable Reports for SPE package). See this link for more details.

SOLR: Solr has it's own dashboard where you can query the index and check what's been indexed or not directly on it.

Coveo: Pretty much like Solr, Coveo has the Admin tool which has a very nice toolset to check your index contents as well as fields indexed, etc.

Hope this answers your question

3
  • 1
    FYI, you can use the Index Viewer in SPE to view any Sitecore index, include SOLR and Coveo.
    – jammykam
    Aug 30, 2017 at 16:06
  • That's true @jammykam but these tools do have their own dashboards which you can benefit out of the box :)
    – Diego
    Aug 30, 2017 at 16:09
  • 1
    Indeed they do... unless you don't have direct access to those servers/dashboards like we don't in Production :)
    – jammykam
    Aug 30, 2017 at 19:00
1

Forgive me for asking but did you REBUILD the search indexes after publishing?

Assuming you have not changed your searching and indexing configuration then after rebuilding the indexes you should see your definition items there.

Make sure your re-indexing operation complete without errors and also please make sure to select the sitecore_web_index in order to have your web items indexed.

enter image description here

If you already did this AND if you are using LUCENE then you could use LUKE like @ThomasBaek suggested.

Another possibility would be to write some code to query your indexes.

Please adapt the code below according to your needs.

    public List<Item> SeachItemInIndex()
    {
                var webDB= Sitecore.Data.Database.GetDatabase("web");
                var itemId = webDB.GetItem("{46587368-HA19-48BB-8FC9-F1DF31GB6C8E}");
                var index = Sitecore.ContentSearch.ContentSearchManager.GetIndex("sitecore_web_index");
                var allItems = new List<Item>();
                    
                using (Sitecore.ContentSearch.IProviderSearchContext context = index.CreateSearchContext())
                {
                    allItems = context.GetQueryable<Item>().Where(x => x.ID == itemID).ToList();
                }    

                return allItems;        
        }

I hope that helps!

Regards

0

To See if the sitecore content field has been indexed in Solr,we can use the query window from the solr dashboard panel.For example, we have Solr running on 8994 and ned to test for an indexed field title in web index, we can use http://localhost:8984/solr/#/sitecore_web_index/query and type title_t:test in the text box to see if the field retrieves results. see screenshot belowenter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.