This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
using HtmlAgilityPack; | |
using Sitecore.ContentSearch; | |
using Sitecore.ContentSearch.ComputedFields; | |
using Sitecore.Data; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<contentSearch> | |
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch"> | |
<indexes hint="list:AddIndex"> | |
<index id="sitesearch_web_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider"> | |
<param desc="name">$(id)</param> | |
<param desc="folder">$(id)</param> | |
<!-- This initializes index property store. Id has to be set to the index id --> | |
<param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<contentSearch> | |
<indexConfigurations> | |
<sitesearchWebConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider"> | |
<indexAllFields>false</indexAllFields> | |
<initializeOnAdd>true</initializeOnAdd> | |
<analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" /> | |
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch"> | |
<fieldNames hint="raw:AddFieldByFieldName"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace YOURNAMESPACE.Search | |
{ | |
public class SiteSearchResult | |
{ | |
public string Title { get;set; } | |
public string PageLinkUrl { get; set; } | |
public string Content { get; set; } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Sitecore.ContentSearch; | |
using Sitecore.ContentSearch.SearchTypes; | |
namespace YOURNAMESPACE.ConcreteModels | |
{ | |
public class PageBaseSearchResult : SearchResultItem | |
{ | |
[IndexField("pagecontentfield")] | |
public string PageContentField{ get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Search(string term, string page) | |
{ | |
if (string.IsNullOrEmpty(term)) | |
{ | |
ViewModel.SearchTerm = "No search term entered"; | |
return; | |
} | |
ViewModel.SearchTerm = term; | |
var sitecoreService = new SitecoreService(Sitecore.Context.Database); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace YOURNAMESPACE.ViewModels.Common.Components.Search | |
{ | |
public class SearchResultsViewModel | |
{ | |
public string ViewPath { get { return Constants.Components.SearchResultsViewPath; } } | |
public IEnumerable<SiteSearchResult> SearchResults { get; set; } | |
public int TotalPageCount { get; set; } | |
public int TotalResults { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model YOURNAMESPACE.ViewModels.Common.Components.Search.SearchResultsViewModel | |
<div class="container-fluid width-90"> | |
<div class="row"> | |
<h1>Search results for “@Model.SearchTerm”</h1> | |
@if (Model.SearchResults != null && Model.SearchResults.Any()) | |
{ | |
foreach (var result in Model.SearchResults) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$root = gi master:// -id "{0C3015B8-77AD-44DC-9633-2AD76489483A}" | |
$items = $root | ls -r | %{$item = $_; $_.Fields | ?{$_.TypeKey -eq "rich text"} } | |
#$items.Count | |
foreach($i in $items){ | |
if($temp){ | |
clear-variable("temp") | |
} | |
if($replaced){ | |
clear-variable("replaced") | |
} |
OlderNewer