Changing the Crawling Root of an Index
Changing the Crawling Root of an Index
By default, Coveo for Sitecore indexes all items under /sitecore/content
, as well as all items under /sitecore/media library/Files
. You may want to change the crawling root of your indexes, most often to prevent indexing undesirable items in specific indexes. This can be particularly useful in multi-site installations, or if you have indexes dedicated to certain content.
By changing the crawling root, you can focus the indexing on an item and its content tree, which can accelerate your indexing time.
Modify a Crawling Root
To change the crawling root of your indexes, follow these steps:
Change the Crawling Root
- Open your
Coveo.SearchProvider.Custom.config
file. It’s located under<Sitecore Instance>\Website\App_config\Include\Coveo
. -
At the end of the
sitecore
node, before the scheduling node, add the following elements:<contentSearch> <configuration> <indexes> <index id="Coveo_web_index"> <locations> <crawler name="ContentCrawler"> <root>/sitecore/content</root> </crawler> </locations> </index> </indexes> </configuration> </contentSearch>
-
Change the
index id
to the index you want to modify. -
Change the
name
of thecrawler
to match the crawler you want to modify. The default names areContentCrawler
for items under/sitecore/content
andMediaItemCrawler
for items under/sitecore/media library/Files
. -
Change the
root
node to the one you want.Ensure that the path you enter includes:
-
Your Coveo-powered search page for all Coveo indexes.
-
Any page containing a Coveo UI component (such as a search box or recommendations).
-
Any datasource that’s feeding Coveo UI components.
Failure to do so results in the following error:
Precondition failed: The parameter 'p_Index' must not be null
.If your desired root node doesn’t include all these pages, you may want to add a new crawling root to specifically include them (see Add a New Crawling Root).
-
- Save and close your file.
Name Your Crawlers
Coveo for Sitecore (July 2016)
In releases prior to July 2016, the index crawlers are unnamed, which can complicate their modification. To name your crawlers, follow this procedure:
-
Open your
Coveo.SearchProvider.config
file. It’s located under<Sitecore Instance>\Website\App_config\Include\Coveo
. -
Under
indexes
>index
>locations
, add a name to your crawler. Crawlers with the root/sitecore/content
should be namedContentCrawler
, while crawlers with the root/sitecore/media library/Files
should be namedMediaLibraryCrawler
.By default, there are two indexes (
master
andweb
) with two crawlers each. If you added new indexes, make sure that you name their crawlers too.You should avoid modifying the
Coveo.SearchProvider.config
file as it can cause unforeseen upgrading issues. Therefore, it’s important that you respect the crawler name and casing.Sitecore 8.0
<crawler name="ContentCrawler" type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase">
Sitecore 8.1
<crawler name="ContentCrawler" type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
-
Save and close the file.
Add a New Crawling Root
You may also want to add a new crawling root to your indexes. To do so, follow these steps:
-
Open your
Coveo.SearchProvider.Custom.config
file. It’s located under<Sitecore Instance>\Website\App_config\Include\Coveo
. -
In the locations node, add the following element.
Sitecore 8.0
<crawler name="CrawlerName" type="Coveo.SearchProvider.CoveoItemCrawler, Coveo.SearchProviderBase"> <database>web</database> <root>/sitecore/content</root> <stopOnError>true</stopOnError> </crawler>
Sitecore 8.1
<crawler name="CrawlerName" type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch"> <database>web</database> <root>/sitecore/content</root> <stopOnError>true</stopOnError> </crawler>
-
Change the name of the crawler to one you deem appropriate.
You should limit the name of your crawler to alphanumeric characters.
-
In the
database
node, enter the name of the database you want to add your crawler to. -
Change the
root
node to your desired crawling root. -
Save and close your file.
Test Your New Configuration
Now that you have changed or added your index crawling root, you need to verify that it works.
Test your new configuration by re-indexing your modified index (see Coveo for Sitecore Indexing Guide). You should notice a change in the number of indexed items that reflects your modifications.
You can also see your indexed item by going to the CES Administration Tool > Content > Index Browser.
You can also see your indexed item by going to the Coveo Platform > Content > Content Browser.