DFS 10.4.0 - Solr

Important

This applies only to Sitecore 9+. For earlier versions, see link

Before reading this guide, we assume that you followed Sitecore's guide how to setup Solr.

After installing DAM For Sitecore, Solr has to be configured to accommodate custom DAM For Sitecore indexes: 

  • dfs_assets_master_index
  • dfs_assets_web_index

This is configured doing the following

1 Create physical cores

To create the physical Solr cores, do the following:

  1. open file explorer on the server on which Solr is installed
  2. navigate to path <solr install dir>\solr-6.6.1-0\apache-solr\server\solr\configsets
  3. copy folder basic_configs into folder <solr install dir>\solr-6.6.1-0\apache-solr\server\solr
  4. rename to dfs_assets_master_index
  5. Repeat 1-4 for dfs_assets_web_index

2 Create cores in Solr UI

To create the cores in Solr UI, do the following:

  1. Open solr UI (e.g. https://127.0.0.1:8983/solr/)
  2. Go to Core Admin
  3. Add both cores (See screenshot below)

3 Populate cores

To populate Solr cores, do the following:

  1. Log into Sitecore
  2. Navigate to control panel
  3. Click Populate Solr Managed Schema
  4. Select both dfs indexes and press populate

4 Add DAM For Sitecore specific dynamic fields

To add DAM For Sitecore specifc dynamic fields, do the following:

  1. Open solr UI (e.g. https://127.0.0.1:8983/solr/)
  2. Select cores from core selector
  3. Under schema, add a new dynamic field with name as "*_lc" and field type lowercase
  4. Do this for both indexes

Please be aware that if you populate the managed schema after adding the dynamic field, then they are overwritten.

5 Changes in managed schema

Locate the managed-schema file under the 2 cores dfs_assets_master_index and dfs_assets_web_index you created in section 1.

  1. Check uniqueKey
    Check the tag <uniqueKey> the value should be _uniqueid.
    Sitecore 9.0.0 populates the managed schema with a wrong uniqueKey, so please double check that the <uniqueKey> tag does indeed contain the correct uniqueKey (it should be _uniqueid).

  2. Change fieldtype "lowercase" to use another tokenizer
    Locate the fieldtype lowercase, and change the tokenizer from solr.KeywordTokenizerFactory to solr.StandardTokenizerFactory.

Then restart the solr service.

See Sitecore documentation for for further information.

6 Searching with hyphen

To be able to search with hyphen, open then configurations file App_Config → Include → damforsitecore → DFS.Settings.config and locate the setting DFS.ContentSearch.FreetextSearch.ReplaceWithSpace. Add a hyphen to the value. like this:

<setting name="DFS.ContentSearch.FreetextSearch.ReplaceWithSpace" value="-" />