forwardfoki.blogg.se

Remove smart search
Remove smart search








remove smart search
  1. #Remove smart search how to#
  2. #Remove smart search code#

#Remove smart search code#

If you cannot return a result, please check your search index settings and re-verify the code in your new class is correct. Once this index has been rebuilt, search for SomeTestText in your search web part to ensure a result has been returned and the search index is working correctly. Add a new Smart search dialog with results web part to your Home page and assign the DoNotSearchExample index to this search web part.Īdd a new Editable text web part to your Home page and add SomeTestText to the content section.Īfter saving this page, go to Site Manager -> Administration -> Smart search -> edit the DoNotSearchExample index -> General, and rebuild the index. You have created the search index, and created a new class containing the example code, so let’s perform a test. Result = Regex.Replace(result, "\\s+", " ", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled) Result = Regex.Replace(result, "]*>", " ") Result = Regex.Replace(result, "", " ", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled) Result = originalHtml.Remove(startIndex, endIndex - startIndex) Var endIndex = originalHtml.IndexOf("", startIndex) + "".Length Var startIndex = originalHtml.IndexOf("") define div tag to exclude from search results Static string SearchHelper_OnHtmlToPlainText(string plainText, string originalHtml) SearchHelper.OnHtmlToPlainText += new SearchHelper.HtmlToPlainTextHandler(SearchHelper_OnHtmlToPlainText)

remove smart search

Assigns a handler for the OnHtmlToPlainText event / Called automatically when the application starts. Private class DocumentCrawlerContentLoaderAttribute : CMSLoaderAttribute / Attribute class for assigning event handlers. You can create a new class in your App_Code folder and add this code: The example code below won’t index any content contained within the do-not-search div tag.

remove smart search

Please remember to assign this index to your current site (Sites tab), and add your Culture to the index (Cultures tab).

remove smart search

Go to Site Manager -> Administration -> Smart search -> New index, create a new index called DoNotSearchExample which uses a Document crawler Index type, and only searches the Home page as shown below. The following example search index is setup as a Document crawler Index type, and is set to only search the Home page for simplicity. originalHTML - allows you to access the raw page code without any modifications.plainText - contains the page output already stripped of all tags and converted to plain text.The OnHTMLToPlainText event provides the following string parameters to the handler: To assign a method of the handler for the OnHTMLToPlainText event, add a new class to the ~/App_Code folder of your web project (or ~/Old_App_Code on web application installations). This event occurs whenever the document search crawler processes the HTML output of a page. In order to achieve this result, you would need use the Document crawler index type and implement custom functionality in a handler for the OnHtmlToPlainText event of the class. Let’s say you want to include only some content for a given page in your smart search index, but also exclude some content for the same page.

#Remove smart search how to#

This article describes how to exclude certain elements from a given page within the Smart Search index.įor Kentico 8 API and customization please see the Defining page indexes documentation.










Remove smart search