Data.In.Add 创建与 DNN 搜索索引相关的一般异常错误

Data.In.Add creates General Exception Error related to DNN Search indexing

我在我的网站上使用 FAQ with Categories 演示,但我在 DNN 日志查看器中不断收到一般异常错误。所有这些都与“_All questions (sorted) of a selected category.cshtml”模板相关,特别是第 13 行:

Data.In.Add("QandA", sorted["Default"]);

异常错误内部消息是"An item with the same key has already been added."下面是完整的错误copy/pasted:

AbsoluteURL:

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke

ExceptionGUID:819672a9-e438-40cf-9e8e-c834b7f1cebb

AssemblyVersion:

PortalId:-1

UserId:-1

TabId:-1

RawUrl:

Referrer:

UserAgent:

ExceptionHash:pkLGSJcpAMGKl0ycv8+1+Q==

Message:Search: Error while indexing module 724 on tab 202, portal 0

StackTrace:

InnerMessage:An item with the same key has already been added.

InnerStackTrace:

at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at ASP._Page_Portals_0_2sxc_FAQ_with_Categories__All_questions__sorted__of_a_selected_category_cshtml.CustomizeData() in q:\dev-dnn.calarts.edu\Portals[=12=]sxc\FAQ with Categories_All questions (sorted) of a selected category.cshtml:line 13 at ToSic.SexyContent.Engines.RazorEngine.CustomizeData() in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContentSexy Content Razor\RazorEngine.cs:line 121 at ToSic.SexyContent.Search.SearchController.GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate) in C:\ProjectsSexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\Search\SearchController.cs:line 68

Source:

FileName:

FileLineNumber:0

FileColumnNumber:0

Method:

Server Name: DEV-DNN

有解决办法吗?

我相信你的数据已经有一个流 "QandA" 所以你不能 "Add" 另一个。如果是这样的话

  1. 要么先删除再添加
  2. 将其替换为数据["QandA"] = ...而不是添加