I ran into an issue in Sitefinity recently, where removing a field from a custom content type caused made the backend search on that type fail. I reproduced this issue on a fresh Sitefinity site, to rule out any potential customizations or changes made in the project I discovered this bug in.
Reproducing the Bug
In a fresh 7.0.5100 Sitefinity install, I created a Speakers module, and a Speaker content type within that module:
Then I created a couple Speakers, so I had something to search for.
Searching for John Doe by email address (“example” in this case) yields the correct result:
Now let’s delete “Email” field from the Speaker content type, making sure that “Update widget templates as well” is checked when saving the changes:
Now let’s try searching again:
After some digging, I found the culprit in one of Sitefinity’s configuration files. The fields that are searched are defined in /App_Data/Sitefinity/Configuration/DynamicModulesConfig.config. There is a node for the custom type (identified by the attribute contentType=”Telerik.Sitefinity.DynamicTypes.Model.Speakers.Speaker”). This node has a child node with an attribute “searchFields.” Even after deleting the field, this still read as:
I removed the deleted field so that Sitefinity stops attempting to search for it:
I then had to restart the web application so that the configuration file changes are re-read by Sitefinity. After doing that and attempting another search, it works!
This was demonstrated in version 7.0.5100 of Sitefinity. I performed the same series of steps in the latest version of Sitefinity at time of writing (7.2.5310), and it exhibited the same behavior. Luckily, the above fix also works in this version.
This is one of the less painful gotchas that one can come across when developing in Sitefinity, as it requires no code changes to rectify. If you come across this issue in a live environment, a configuration change and a restart is all that’s required to eliminate the issue.
It’s important to note that this backend search box is not driven by search indexes created in “Administration -> Search indexes”, but if you have a search index configured to search for a now-deleted custom field, you have update that yourself too!
Latest posts by Falafel Posts (see all)
- Matching Complex Query String Rewrite Rule in IIS - March 22, 2017
- Using Google Services in UWP C# Apps – Part 2 - February 7, 2017
- Using Google Services in UWP C# Apps – Part 1 - February 6, 2017
- Redis Caching in the Google Cloud Platform - February 3, 2017
- Entity Framework with Google Cloud SQL - February 2, 2017