Kategoriarkiv: search

Add Search Verticals by code

search-verticals-001

Adding own search verticals is a common task in the Search Configuration in SharePoint. Here I want to share a code sample for achieving this programmatically. I hope, this model can be added to SPMeta2.

First of all, Search Verticals are dedicated Search Results Pages and links to them. How to add them manually is described on technet:

There is no API in CSOM for that. Luckily, Mikael Svenson found how to get the Search Navigation and contributed to PnP by writing an Extension: web.LoadSearchNavigation.

Here is my sample code for adding new Search Verticals programmatically:

Resetting SharePoint Search Configuration Cache

Now it is the second time it happens that the search cannot return any results. This hickup is rare but it happens. To solve it I had to follow these steps:

  1. Stop the Timer Service
  2. Clear the configuration cache
    1. Find in ProgramDataMicrosoftSharePointConfig the folder where the file cache.ini exists
    2. Delete every file from this folder EXCEPT cache.ini
    3. Open cache.ini, delete the content and put ’1′ (without the quotes) in it and save the file
  3. Restart the Timer Service
  4. Index reset
  5. Full crawl

Source: ITIDea. The linked blog post saved my afternoon today. Thank you, Anita Boerboom.

Resetting SharePoint Search Configuration Cache

Now it is the second time it happens that the search cannot return any results. This hickup is rare but it happens. To solve it I had to follow these steps:

  1. Stop the Timer Service
  2. Clear the configuration cache
    1. Find in ProgramDataMicrosoftSharePointConfig the folder where the file cache.ini exists
    2. Delete every file from this folder EXCEPT cache.ini
    3. Open cache.ini, delete the content and put ’1′ (without the quotes) in it and save the file
  3. Restart the Timer Service
  4. Index reset
  5. Full crawl

Source: ITIDea. The linked blog post saved my afternoon today. Thank you, Anita Boerboom.