SupportedFeatures field, Search Indexer exceptions, oh my.
I had one of my usual strange problems tonight. The search indexer on a DNN web site I created some months ago would not index the entire site. I got suspicious and checked the event log, where there were pages after pages of general exceptions.
Most errors seemed to be something like:
System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey) at DotNetNuke.Services.Search.ModuleIndexer.GetModuleList(Int32 PortalID)
Okay, this could not be the real error! I had to find the real cause.
First try - cleaning the search index in case it's been corrupted
The first thing I tried (and I advice you to do that before you try anything else) was to start with a clean search index, in case it was somehow corrupted. What you can do is the following (taken from this post):
If by accident the search index got corrupted, there will be no serach results displayed any further and you have to delete the search index tables manually. Follow these steps:
Login as Superuser ("host" by default)
In Host Menu select item "SQL"
Copy the following 4 lines and paste them into the text box:
truncate table {databaseOwner}{objectQualifier}SearchItemWordPosition
DELETE {databaseOwner}{objectQualifier}SearchItemWord
DELETE {databaseOwner}{objectQualifier}SearchWord
DELETE {databaseOwner}{objectQualifier}SearchItem
Activate the check box and hit Run
The search index will be rebuilt automatically by the scheduler.
(Although this is the right way, I've found that a DELETE {databaseOwner}{objectQualifier}SearchItem will be sufficient. If you don't have a special db owner or a specific object qualifier, a DELETE from SearchItem will do the same job, either on your SQL Server Management Studio or your Host-SQL page).
Also, you don't have to wait for the scheduler. Go to host-search admin and rebuild the index yourself.
Second try - checking and correcting the SupportedFeatures field on the DesktopModules table
Well, starting with a clean index didn't help, so I searched further. What I found surprised me. Let's see what this post says:
It seems that the desktopmodules table has a supportedfeatures field that should be set to 0 or higher. But sometimes when modules are installed they end up with a -1 so this causes the error. Setting the fields to 0 when they are -1 fixes it, like so:
UPDATE [databasename].[dbo].[DesktopModules]
SET [SupportedFeatures] = 0
WHERE [SupportedFeatures] = -1
This is for SQL Server Express... don't know how it would work in the SQL page of DNN.
The solution
Well, I did a check on my own DesktopModules table. And suprise, surprise, two modules had a value of -1 for the SupportedFeatures field. As expected, these were the two modules that were generating the exceptions and blocked the indexer from indexing the whole site.
I did what the post said, and kaboom! Indexer worked perfectly, no more exceptions.
What the SupportedFeatures field actually does
What troubled me was what this field actually represents. I had values of 6, 7, 0 etc in other modules' records. So I dug a bit further and found this post:
This is a bit field where
2^0 = 1 indicates IPortable
2^1 = 2 indicates iSearchable
2^2 = 4 indicates iUpgradable
add those values for combinations (i.e. 7 = 1 +2+4 = IPortable,iSearchable and iUpgradable)
So this solved the mystery. Those two modules were installed in a wrong way and got an invalid value of -1 for their SupportedFeatures field, which in turn caused the exceptions when the Search Indexer ran.
Where and when can this happen?
My DNN site was version 5.2.2, but as far as I understand this thing can happen on various DNN versions, depending on the modules installed and how well the installation process is executed. I can't say that exceptions from the Search Indexer are always due to this particular problem, so use this proposed solution with extreme caution if it happens to you, and always have a database backup handy!
Read more...