Sitecore 7 depends heavily on search. The more you know about how the search engine works, the better. And some of the most important tools you have at your disposal for understanding how your search engine works are those tools that are available for your search engine.
The sorts of tools available to help you develop and debug are different for each one. Even search engines that are closely related, such as Lucene and Solr, have very different tools available.
In this post I cover how to use Luke, a popular tool for Lucene, in order to perform some basic investigation and troubleshooting.
Luke is a free, open source product available at https://code.google.com/p/luke/. Luke can be used with previous versions of Sitecore, but this post is specifically covering Sitecore 7.
Since Sitecore 7 uses Lucene 3, you need a version of Luke that is compatible. I am using version 3.5.0, which I downloaded from https://code.google.com/p/luke/downloads/detail?name=lukeall-3.5.0.jar.
Luke is a Java application, so you need to be sure the Java runtime (JRE) is installed on your machine. If the JRE is installed, all you should have to do is double-click the jar file and Luke will start up.
The first thing Luke needs to know is the location of the Lucene index files. Each index has its own folder in the index folder. The index folder is specified in the IndexFolder setting in web.config. By default this is a folder named "indexes" located in the Sitecore data folder.
For this example, I want to use the index for the master database. In my environment, this index is located at Z:\Sitecore\Data\indexes\sitecore_master_index.
Luke will display information about the index. You might need to enlarge the window in order to see all of the information properly (an example of see the area in the red box below).
On the bottom-left of the screen Luke displays a list of fields. These are the fields that can be searched for using the Sitecore content search API. The fields that are available depend on your Sitecore configuration.
You can see the top terms that have been indexed for a specific field.
If you right-click the term you can get to a couple of screens that allow you to view the matching documents. "Browse term documents" takes you to the Documents tab, with the "Browse by term" section already populated with the term and value you selected.
Click "First Doc" in order to see all of the fields for the first document in the index.
On the Documents tab, if you click "Show All Docs" you will be taken to the Search tab. A search expression is already populated with the appropriate Lucene search syntax, and the search results appear below.
Here are some tips that might be helpful for first-time users:
The main reason I wrote this post is because Luke is a tool that can help you better understand how the Sitecore 7 content search API works, especially how some of the different indexing-related settings work.
I can use Luke to see what happens when new fields are added to a template. Before I add the field, however, I want to use Luke to see what is already being indexed.
I can see the fields that have been indexed for the Home item:
The list of fields displayed here are the values that are available to the "hydrate" process. (That's the process that automatically populates POCO. The Sitecore 7 dev team has posted an article about using POCOs.)
But if you look in here, you'll notice that the fields AAA and BBB are missing. This may seem counterintuitive: the field and its value is clearly available in the index, but the value is not displayed.
Before I explain how you can fix this, I need to explain how the AAA and BBB fields are indexed in the first place.
If you look in the Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config file, you will find the following line. This line is responsible for the fields AAA and BBB being indexed.
This line is also responsible for the AAA and BBB fields not being displayed in Luke. This is because of the "storeType" setting in the config files. This setting ensures Lucene indexes the value, but Lucene doesn't store the value so it is available to the hydrate process.
The reasons for and against storing values is a topic for another blog. I don't want to change the settings so every Single-Line Text field is stored. But I do want to change the settings so the AAA field is stored. To do that I need to make a change to the Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config file.
Stopwatch stopWatch =
var index = ContentSearchManager.GetIndex(
(var context = index.CreateSearchContext())
.Where(item => item._templatename ==
.Where(item => item._language ==
You can also use Luke to examine Solr indexes (look in <solr root>/<corename>/data). The problem is if you are using a newer version (Solr 4.*) then the standard Luke is not compatible with Lucene 4.1 / 4.2 and 4.3 index versions. There is a project here : github.com/.../luke that has forked luke to fix these issues but you need to compile it yourself. A binary that supports Solr 4.2 can be found here : www.semanticmetadata.net/.../ Luke is actually built into Solr and can be used to analyse fields directly from the Solr admin pages using the schema browser.
Is it possible to check computed index fields by Luke? I actually failed to find them in Luke.
Just figured out that is possible to do (see computed fields in Luke). So, disregard my question :)
Can you configure a fieldMap using the field id instead of name ? Also where are these configuration values documented ?
My Sitecore 7 (130424) search page throws an "Could not create instance of type: Sitecore.ContentSearch.LuceneProvider.Analyzers.DefaultPerFieldAnalyzer. No matching constructor was found." exception since I ran Luke 3.5.0 (code.google.com/.../detail on the same machine the site is running on. I have not solved the issue yet, I'd appreciate any suggestions. Thanks, M