0
votes

We have our own custom search input module, Search Results Module and a Module for Displaying products on our DotNetNuke website.

Currently we send the search term from our Search Input module to our Custom Search Results Module page with a Query-string which will show products from our ERP system via Ajax. I now want to include DNN crawled results as well (Pages and etc).

  1. How do I send the search query to the DNN side to bring back results as well?
  2. Which code can I add to our Search Results page?

I would also like to know how we can get the DNN site crawler to crawl pages for content on our custom modules which uses Ajax? For example: we have a product filter module which will retrieve results from our ERP system: https://www.parrot.co.za/Product-Categories/Product-Filter?Category=126&whiteboards

I looked at this page with no answer to my specific questions: http://www.dnnsoftware.com/community-blog/cid/154913/integrating-with-search-introducing-modulesearchbase

1

1 Answers

2
votes

Q) How do I send the search query to the DNN side to bring back results as well?

A) Issue a call to the ModuleSearch method of the SearchController in your search results service to get the DNN search results:

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);

From there, you can get the DNN search results from the searchResults.Results list and return to your search results module UI.

Q) How we can get the DNN site crawler to crawl content on our custom modules.

A) You can give custom search result data the DNN Site Crawler by implementing the ModuleSearchBase class in your custom module. This allow custom data to get into the DNN search results so you can leverage the above query API to get the data.

This is a large topic for this discussion. You can see other posts I've made on the topic in addition to get a full tutorial from DNNHero.com if you choose to subscribe.