I’ve worked on various Sitecore implementations where the customer has often run into issues with data not being returned as expected the first thing I do now to troubleshoot is to check the Solr Index.
Check Solr Is Up
- If you are not sure of the address of your Solr instance you can locate the url in the following configuration file app_config/includes/Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config and the setting, for example: <setting name=”ContentSearch.Solr.ServiceBaseAddress” value=”https://localhost:8983/solr“></setting>
- Use Solr Ping to check the status of the master solr index http://localhost:8983/solr/sitecore_master_index/admin/ping?wt=json
- You should receive the following output with the status of OK:
Check The Sitecore Logs
There are two Sitecore logs associated with Search that can help provide insight when you are experiencing issues with Solr:
- The crawling.log file contains information about the indexing process and its operations.
- The search.log file contains information about the search queries that Sitecore executes.
So if you run your Sitecore instance and perform the functionality that isn’t returning data as expected you will see those queries written to this search.log. You’ll see lots of different requests being made to solr that look like: Solr Query – ?q=(_template:(1b93c428d8774a15a0f67dbc9be1b4ea) AND jdedivisionid_tl:(380))&rows=2147483642&fq=_indexname:(sitecore_master_index)
Attempt to Query the Solr Index directly
You can run queries against the solr index directly by:
- Access the solr instance
- Select the index it probably going to be Sitecore_Master_Index or the Sitecore_Web_Index or a custom application index.
- Once selected click the query link.
- You will notice the url in solr instance will change and display the selected index this help verify you have selected the correct index <instancename>/solr/#/sitecore_master_index/query</instancename>
- If you leave all the default query settings as they are and click the Execute Query button Solr will return the total number of documents in the index.
- To execute your query from the Sitecore Search log copy the query from log basically everything after “?q=” and before “&rows”
so using the example above : (_template:(1b93c428d8774a15a0f67dbc9be1b4ea) AND jdedivisionid_tl:(380)) - Paste this into the q field you can leave everything else as is and click Execute Query the results will be displayed.
- If the query was successful the response will contain a list of documents that match the query with a summary of the total number of documents contained in the results.
- If there are no documents matching the query then no documents are returned. You may need to rebuild the index.