Gravatar for juanpablo.albuja@verndale.com

Question by jpalbuja, Nov 6, 2015 4:23 PM

Coveo Index configuration in Sitecore 8

Hi everyone, I installed Coveo for Sitecore and my local environment is up and running and the master and web coveo indexes has been created by default. Now, I want to do the following configurations

1. Disable the default sitecore web and master indexes. sitecore_web_index, sitecore_master_index. 2. Instead of using the above ones use Coveo_master_Index and Coveo_web_Index 3. Rename the Coveo_master_Index and Coveo_web_Index to something else like XYZ_web_index and XYZ_master_index 4. Do the following configuration:

- XYZ_web_index: -> Index Published Site - XYZ_master_index -> Index used by sitecore editors - Create a new Coveo index for the preview mode of sitecore.

Is the above possible with Coveo? Also Sitecore has other indexes like the core, sitecore_marketing_asset_index_master, sitecore_marketing_asset_index_web, etc.. Can those other indexes can be configured also to use Coveo entirely?

Thanks

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Nov 6, 2015 5:56 PM

Hi Juan Pablo,

Your post is composed of many questions. I'll try to answer to all of those.

Let me clarify why Coveo is creating separate indexes for the master and web databases in Sitecore 8 instead of replacing the Lucene ones. Coveo's main benefit in Sitecore is to offer a great search experience to visitors of your website. Coveo is not really improving the experience of content editors by replacing the master, web and core Lucene indexes. Coveo for Sitecore on Sitecore 7.X replaces the Lucene master, web and core indexes by Coveo ones because it was a requirement on Sitecore 7.0 and 7.1 that weren't able to run more than one search provider at the same time. In version 8, Sitecore added a lot of new indexes that are unrelated to the visitors searches. Thus, instead of replacing all those new indexes, Coveo decided to focus on improving the visitors search experience. With that objective and performance in mind, we created copies of the web and master indexes to limit the number of queries those indexes would receive. The Coveo indexes receive only visitors queries (and the edit/preview mode queries). The Lucene indexes continue to receive the content editors and Sitecore tools queries. I hope this helps to understand the default architecture.

For your questions, first, I noticed one thing you want to do that cannot be done in Sitecore: Renaming the "sitecore_master_index" to "XYZ_master_index". This is because Sitecore refers to this index name in constants in its own code and/or its configuration files. Thus, you cannot rename the main master index. I know that the web and core indexes can be renamed. I don't know for all the other Sitecore 8 indexes. You'll need to try by yourself.

Secondly, Coveo never tested to replace all the new Sitecore 8 indexes like the "sitecore_marketing_asset_index_master" and "sitecore_marketing_asset_index_web". It may work or not. In fact, Coveo doesn't offer official support to people converting those Lucene indexes to Coveo indexes. It is at your own risk.

For the Sitecore preview mode index you want to create, I don't think it is possible either. Sitecore preview mode always use the master database to load the items from (even if you are editing the web database items from the desktop mode). Coveo UI controls work by looking for the first Coveo index that indexes this context database. In that case it would be the "Coveo_master_index" (or any name you give it). This logic cannot be changed and you cannot specify the index to use for the Coveo UI components.

With all that in mind, I would suggest you to rename the "Coveo_master_index" to "sitecore_master_index" and to rename the "Coveo_web_index" to "sitecore_web_index". The names will then be the same names as the out of the box Lucene indexes defined in the `Sitecore.ContentSearch.*.config` files. Since the `Coveo.SearchProvider.config` file is loaded before the `Sitecore.ContentSearch.*.config` files, the Coveo indexes will be loaded before and will replace the Lucene ones. You will end with just one master and one web index that will be used both by the Sitecore tools and Coveo UI components.

For the core index, you can duplicate the "Coveo_master_index" node to create your configuration of a "sitecore_core_index" and change the "master" references to "core" like this:

$(id) core /sitecore true

core

    <key>$(id)</key>
    <database>core</database>
  </propertystore>
</index></p><p>I hope this answers all your questions. Don't hesitate to comment if you need clarifications.</p><p>Jeff</p>
Gravatar for juanpablo.albuja@verndale.com

Comment by jpalbuja, Nov 9, 2015 2:05 PM

Hi @jflheureux ♦♦, in order to do not modify the coveo file Coveo.SearchProvider.config, I was thinking that is a good idea to create another .config file that contains the configuration that you mentioned. Is that possible? Because it looks like what is on the file Coveo.SearchProvider.config it is still taking affect after I create another config file with the structure:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Coveo.SearchProvider.Configuration.CoveoSearchConfiguration, Coveo.SearchProvider">
        <indexes hint="list:AddIndex">

Also, what I got is I can rename in my config file web and core indexes right? but not master index?

Thanks so much

Gravatar for sholmesby@hhogdev.com

Comment by sholmesby, Nov 9, 2015 2:28 PM

This should work fine (as we have done the same thing). You just have to ensure the file is alphabetically later than the default Coveo.SearchProvider.config. This way it gets patched AFTER the default one.

Naming the file z_whatever.config usually does this…. or within a folder works as well.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Nov 9, 2015 2:44 PM

Hi,

You can safely modify the `Coveo.SearchProvider.config` file as this one is not overridden when you upgrade Coveo for Sitecore. A new file is instead created with the name `Coveo.SearchProvider.config.example`.

You can also go with your patch file option. Be sure that your file name is loaded after the `Coveo.SearchProvider.config` one by having a name that starts with the letter "d" or higher or moving the config file in a subfolder. In this case, you have to use the Sitecore configuration patching XML elements to do your changes.

As I mentioned in my answer, the `Coveo.SearchProvider.config` file is loaded before the `Sitecore.ContentSearch.*.config` files. Thus, the Coveo indexes will be loaded before and will replace the Lucene ones if they have the same names.

This logic also applies to your custom configuration file. If the `Coveo.SearchProvider.config` file still declare indexes, they will be loaded in Sitecore. Then, if you declare one with the same name in your custom configuration file, it will be merged with the existing one but if you declare one with a new name it will be added to the indexes list.

Here's an example:

XYZ_web_index
          </index>
          <!-- To add an attribute to an index -->              <index id="Coveo_master_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">
            <newattribute>NewValue</newattribute>
          </index>
          <!-- To create a new index --><p>              <index id="Coveo_new_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider">

$(id) SomeDatabase /sitecore true

SomeDatabase

              <key>$(id)</key>
              <database>core</database>
            </propertystore>
          </index>




</p></indexes></configuration></contentsearch></sitecore></configuration>
Ask a question