6

For a recent customer, we moved them to SOLR, which I highly recommend for production environments over Lucene, and we encountered a few issues, as some of the Lucene indexes had some uppercase characters in their names. No errors occurred, however, no results would return from ContentSearch for those indexes.

Nothing in the Sitecore or SOLR logs helped either. SOLR was just silently not returning results from the index.

So, my question is, in a Sitecore/SOLR Best Practices document anywhere, is this issue documented and we just didn't find/see it or should it even be a best practice for Lucene indexes?

1

2 Answers 2

8

After some investigation of my own. I've found that indexes don't actually have to be lowercased. The issue is with how Sitecore sends the query to SOLR. Take the example query below:

?q=(_fullpath:(\/sitecore/content*) AND _template:(113102dfb569477791acfffc90244536))&rows=2147483647&fl=*,score&fq=_indexname:(myIndex_sitecore_master_index)

The index, in this case, is named myIndex_sitecore_master_index. Sitecore is able to ping the index properly, but no results are returned. The issue is that Sitecore also pushes the FilterQuery (fq) parameter with the query. The value for _indexname passed is myIndex_sitecore_master_index. At first glance, this doesn't appear to be a problem, however, after reviewing the stored documents, the _indexname field is stored as the lowercase variant on each document:

(JSON response)

...
"__lock_s": "sitecoreuser",
"_version": "1",
"_template": "113102dfb569477791acfffc90244536",
"_indexname": "myindex_sitecore_master_index",
"_version_": 1582958236651225000,
"_indextimestamp": "2017-11-02T12:43:34.2Z"
...

Therefore this document does not satisfy the FilterQuery parameter and thus, no documents are returned. Effectively, the fq parameter is combined with the earlier q parameter, but the fq piece is cached. Therefore, Sitecore (in my example) is looking for a document where:

  • Path starts with /sitecore/content
  • Has a Template ID of 113102dfb569477791acfffc90244536
  • Has an _indexname of myIndex_sitecore_master_index <- this fails

I will submit this to Sitecore as a bug since if they passed the fq parameter as the lowercase variant, this would not be an issue.

--- Edit ---

Confirmed Sitecore bug: 140821

1
  • 1
    That is what I found as well. Quick fix was to change index name to lower case, but yes, it truly is a bug within Sitecore where it is lower casing the index name in fq as you have confirmed. Thanks! Commented Nov 2, 2017 at 15:07
2

SOLR documentation is not explicit about casing of index and collection names (however all examples specify core names in lowercase). There is a somewhat related issue about case sensitivity of SolrCloud's collection name.

If I were you, I would stick to lowercase Solr core names, but feel free to re-post the question in SO with Solr tag or contact Solr's mailing list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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