This file contains 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> | |
<CustomSearchConrig> | |
<!-- INDEXING STRATEGIES | |
Here is a list of the different indexing strategies that you can use. You can also combine these strategies to achieve what you want. | |
--> | |
<indexUpdateStrategies> | |
<!-- INTERVAL BASED INDEX REBUILD STRATEGY FOR CORE DATABASE |
This file contains 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 class ImageUrl : IComputedIndexField | |
{ | |
public object ComputeFieldValue(Sitecore.ContentSearch.IIndexable indexable) | |
{ | |
Item item = indexable as SitecoreIndexableItem; | |
if (item != null) | |
{ | |
var fileField = ((FileField)item.Fields["Image"]; |
This file contains 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 class IsStandardValue : IComputedIndexField | |
{ | |
public object ComputeFieldValue(IIndexable indexable) | |
{ | |
Item item = indexable as SitecoreIndexableItem; | |
return StandardValuesManager.IsStandardValuesHolder(item); | |
} | |
public string FieldName { get; set; } |
This file contains 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 static class SitecoreAccountExtensions | |
{ | |
public static MembershipUser GetMembershipUser(this Account account) | |
{ | |
return Membership.GetUser(account.Name); | |
} | |
} |
This file contains 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 static Item HomeItem(this SiteContext site) | |
{ | |
return Sitecore.Context.Database.GetItem(site.StartPath); | |
} |
This file contains 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 class ItemComparer : IEqualityComparer<Item> | |
{ | |
public bool Equals(Item x, Item y) | |
{ | |
return x.ID == y.ID; | |
} | |
public int GetHashCode(Item obj) | |
{ | |
return obj.ID.GetHashCode(); |
This file contains 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 class ItemTemplateComparer : IEqualityComparer<Item> | |
{ | |
public bool Equals(Item x, Item y) | |
{ | |
return x.TemplateID == y.TemplateID; | |
} | |
public int GetHashCode(Item obj) | |
{ | |
return obj.TemplateID.GetHashCode(); |
This file contains 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
Sitecore.Data.MasterVariablesReplacer replacer = Sitecore.Configuration.Factory.GetMasterVariablesReplacer(); | |
Sitecore.Diagnostics.Assert.IsNotNull(replacer, "replacer"); | |
replacer.ReplaceItem(item); | |
This file contains 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 static string GetImageUrl(this MediaItem mediaItem, int maxWidth = 0, int maxHeight = 0) | |
{ | |
return GetMediaUrl(mediaItem) + CreateImageSizeQuery(maxWidth, maxHeight); | |
} | |
public static string GetMediaUrl(this MediaItem mediaItem) | |
{ | |
var mediaUrl = MediaManager.GetMediaUrl(mediaItem); | |
return mediaUrl.Contains(MediaManager.MediaLinkPrefix) |
This file contains 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 SearchResult<SearchItem> Search(string keywords) | |
{ | |
using (var context = Sitecore.ContentSearch.ContentSearchManager.GetIndex(_searchIndex).CreateSearchContext()) | |
{ | |
var queryable = context.GetQueryable<SearchItem>(); | |
Expression<Func<SearchItem, bool>> filters; | |
filters = GetKeywordFilters(keywords); | |
queryable = queryable.Where(filters); |
OlderNewer