With a lot of help from Kentico Support we've finally gotten our MVC app to call the smart search, and now it's throwing this error.
System.ArgumentException
Column 'DocumentModifiedWhen' does not belong to table Table.
at System.Data.DataRow.get_Item(String columnName)
at Kentico.Search.SearchService.GetAdditionalData(Object type, Int32 documentNodeId, String& date, Int32& nodeId, String& pageTypeDisplayName, String& pageTypeCodeName)
at Kentico.Search.SearchService.GetSearchItems()
at Kentico.Search.SearchService.Search(String query, Int32 page, Int32 pageSize, Int32& numberOfResults) at shawmvc.Controllers.SearchController.Index(String searchText, Nullable`1 page) in c:\Projects\Kentico\CMS\ShawMVC\Controllers\SearchController.cs:line 118
To me this looks like a bug in the underlying Kentico SQL stored procedures or generated scripts, because I can't find this column on any of the custom tables or page types that are included in the search indexes that we're searching on.
Any idea of how to find this column, or tell the API call not to include this column would be helpful.
Otherwise I guess I'll have to open a support/bug ticket.
thanks
Marcel
EDIT
Here's the relevant code:
var indexInfos = SearchIndexInfoProvider.GetSearchIndexes();
string[] indexNames = (from i in indexInfos
select i.IndexCodeName).ToArray();
mService = new SearchService( indexNames,
CultureHelper.GetDefaultCultureCode( "SCGDEV" ), "SCGDEV",true );
var pageIndex = (page ?? 1) - 1;
SearchResults model = null;
model = new SearchResults()
{
Items = mService.Search(searchText, pageIndex, PAGE_SIZE, out totalItemsCount),
PageIndex = pageIndex,
PageSize = PAGE_SIZE,
Query = searchText,
TotalItemCount = totalItemsCount
};