On a site running Sitecore 6.2, I need to give the user the ability to selectively exclude items from the search results.
To do this, I added the "Include in search results" check box, and I created a custom database crawler to check this field value:
~ \ App_Config \ Include \ Search Indexes \ Website.config:
<search> <configuration type="Sitecore.Search.SearchConfiguration, Sitecore.Kernel" singleInstance="true"> <indexes hint="list:AddIndex"> <index id="website" singleInstance="true" type="Sitecore.Search.Index, Sitecore.Kernel"> ... <locations hint="list:AddCrawler"> <master type="MyProject.Lib.Search.Indexing.CustomCrawler, MyProject"> ... </master> </locations> </index> </indexes> </configuration> </search>
~ \ Lib \ Search \ Indexing \ CustomCrawler.cs:
using Lucene.Net.Documents; using Sitecore.Search.Crawlers; using Sitecore.Data.Items; namespace MyProject.Lib.Search.Indexing { public class CustomCrawler : DatabaseCrawler {
Interestingly, if I rebuild the index using the Index Viewer application, everything behaves as usual. Items whose "Include in search results" box is not checked will not be included in the search index.
However, when I use the search index rebuilder in the Sitecore dashboard application or when the IndexingManager automatically updates the search index, all items are included regardless of whether they are βInclude in search resultsβ.
I also set many breakpoints in my custom crawler class, and the application never hits any of them when I rebuild the search index using the built-in indexer. When I use the Index Viewer, it hits all the breakpoints that I set.
How do I make Sitecore's built-in indexing processes respect my "Include in search results" checkbox?
user212218
source share