Skip to content

Instantly share code, notes, and snippets.

View jstemerdink's full-sized avatar

Jeroen jstemerdink

View GitHub Profile
/// <summary>
/// Class FacetAttribute. This class cannot be inherited.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public sealed class FacetAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="FacetAttribute"/> class.
/// </summary>
/// <param name="index">The index.</param>
public class CustomCatalogItemChangeManager : CatalogItemChangeManager
{
private readonly IScheduledJobRepository scheduledJobRepository;
public CustomCatalogItemChangeManager(
IChangeNotificationManager changeNotificationManager,
EntryIdentityResolver entryIdentityResolver,
IScheduledJobRepository scheduledJobRepository)
: base(changeNotificationManager: changeNotificationManager, entryIdentityResolver: entryIdentityResolver)
{
public void GetProductUrl(ProductContent product, ContentReference catalogLink, out string path)
{
path = product.RouteSegment;
ContentReference parentLink = product.ParentLink;
if (catalogLink.CompareToIgnoreWorkID(contentReference: parentLink))
{
return;
}
{
"Serilog": {
"Using": [ "Serilog.Sinks.File" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"EPiserver": "Information",
"EPiServer.Commerce": "Debug"
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Linq.Expressions;
using EPiServer;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Core;
using EPiServer.Find;
CREATE TABLE [dbo].[tblFindTrackingQueue]
(
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[TrackingId] [nvarchar](max) NOT NULL,
[NrOfHits] [int] NOT NULL,
[Query] [nvarchar](max) NOT NULL,
[Tags] [nvarchar](max) NOT NULL
);
GO
@jstemerdink
jstemerdink / autocorrect.cs
Created November 12, 2019 14:30
Auto correct the query before sending it to your search engine
public string AutoCorrect(string query)
{
if (query.Length < 5)
{
return query;
}
SpellCheckClient spellCheckClient = new SpellCheckClient(new ApiKeyServiceClientCredentials("Your_BING_SpellCheck_Key_Here"));
HttpOperationResponse<SpellCheckModel> result = spellCheckClient.SpellCheckerWithHttpMessagesAsync(text: query, mode: "spell", setLang: ContentLanguage.PreferredCulture.TwoLetterISOLanguageName).Result;
public class Global : EPiServer.Global
{
protected void Application_Start()
{
// Other stuff here
// See: https://support.microsoft.com/en-gb/help/821268/contention-poor-performance-and-deadlocks-when-you-make-calls-to-web-s
// See: https://docs.microsoft.com/en-us/azure/redis-cache/cache-faq
SetMinThreads();
SetMaxThreads();
namespace Epi.Libraries.Commerce.Predictions
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Web;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Commerce.Catalog.Linking;
using System.Collections.Generic;
using System.Linq;
using EPiServer;
using EPiServer.Core;
using EPiServer.Framework.Localization;
using EPiServer.ServiceLocation;
using EPiServer.Validation;
/// <summary>