与 DNN 搜索集成(将搜索功能添加到自己的搜索输入、搜索结果和索引自定义模块)

Integrating with DNN Search (Adding Search Functionality to own Search Input, Search Results and Indexing Custom Modules)

我们有自己的自定义搜索输入模块、搜索结果模块和用于在我们的 DotNetNuke 网站上显示产品的模块。

目前,我们将搜索词从我们的搜索输入模块发送到我们的自定义搜索结果模块页面,其中包含一个查询字符串,它将通过 Ajax 显示我们 ERP 系统中的产品。我现在也想包括 DNN 抓取的结果(页面等)。

  1. 如何将搜索查询发送到 DNN 端以同时返回结果?
  2. 我可以将哪些代码添加到我们的搜索结果页面?

我还想知道如何让 DNN 站点爬虫抓取我们使用 Ajax 的自定义模块上的内容页面?例如:我们有一个产品过滤器模块,它将从我们的 ERP 系统中检索结果:https://www.parrot.co.za/Product-Categories/Product-Filter?Category=126&whiteboards

我查看了此页面,但没有回答我的具体问题:http://www.dnnsoftware.com/community-blog/cid/154913/integrating-with-search-introducing-modulesearchbase

问)如何将搜索查询发送到 DNN 端以同时返回结果?

A) 在您的搜索结果服务中调用 SearchController 的 ModuleSearch 方法以获取 DNN 搜索结果:

using DotNetNuke.Services.Search.Controllers;
using DotNetNuke.Services.Search.Entities;
...


var query = new SearchQuery
{
    PageSize = request.PageSize,
    PageIndex = (request.PageNum > 0 ? request.PageNum : 1),
    SortField = SortFields.Relevance,
    SortDirection = SortDirections.Descending,
    KeyWords = request.Keyword,
    Tags = new List<string>() { "tag1", "tag2" },
    PortalIds = new List<int> { PortalSettings.PortalId },
    WildCardSearch = true,
};

var searchResults = SearchController.Instance.ModuleSearch(query);

从那里,您可以从 searchResults.Results 列表和 return 中获取 DNN 搜索结果到您的搜索结果模块 UI。

问)我们如何让 DNN 站点爬虫爬取我们自定义模块上的内容。

A) 您可以通过在自定义模块中实施 ModuleSearchBase class 为 DNN 站点爬虫提供自定义搜索结果数据。这允许自定义数据进入 DNN 搜索结果,因此您可以利用上述查询 API 来获取数据。

这是本次讨论的一个大话题。选择订阅即可看到other posts I've made on the topic in addition to get a full tutorial from DNNHero.com