Reputation: 4506
I just setup my Solr search functionality in Sitecore and it indexed the site. I can do a search and I get back results. Unfortunately, it indexed TOO much, and is returning system specific things such as templates and analytics nodes in teh content tree. I type in things like 'system' it returns to me things in the /system/ folder and elsewhere.
I was able to reduce a lot of it by adding templates to exclude, but I'd rather just tell it to avoid 1 or two specific folders alltogether (the layout folder, the system folder, etc).
Is there a way to do this in the ContentSearch config? If not, how can I do this?
Thanks!
Upvotes: 3
Views: 208
Reputation: 16990
You can create a custom index and restrict it to just the content you want in that index by setting the root
node:
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="my_custom_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
...
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>web</Database>
<Root>/sitecore/content</Root>
</crawler>
</locations>
....
</index>
</indexes>
</configuration>
</contentSearch>
Note that index id
attribute is set to a custom index name and root node is changed to root
node. The above was a copy of Sitecore.ContentSearch.Solr.Index.Web.config
, you may need to create a similar one for master
based on your requirements.
You can find more information about defining your own custom indexes in this blog post: Defining a custom index in Sitecore 7, the absolute minimum
Alternatively, leave the default indexes alone and add a filter to your own search query to restrict the returned results to /sitecore/content
only.
Upvotes: 5