Skip to content

Instantly share code, notes, and snippets.

View martinrayenglish's full-sized avatar

Martin English martinrayenglish

View GitHub Profile
@martinrayenglish
martinrayenglish / PowershellRedirectImport.ps1
Created December 11, 2016 14:16
Powershell script that targets a CSV file in the media library and creates simple redirect items for each data record
<#
.SYNOPSIS
Script targets a CSV file in the media library and creates simple redirect items for each data record
.NOTES
Martin English
#>
#Target csv file in media library
$media = "/sitecore/media library/import-data"
@martinrayenglish
martinrayenglish / Sitecore.AzureDev.IndexDefinitions.config
Last active May 10, 2018 16:02
Patch file to update Sitecore Index names to allow developers to share an Azure Search Service. Simply set the environment variable and drop this file in the "Include/zzz" folder
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<sc.variable name="environment" value="martin_dev_" />
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_master_index" type="Sitecore.ContentSearch.Azure.CloudSearchProviderIndex, Sitecore.ContentSearch.Azure">
<param desc="name" patch:instead="param[@desc='name']">$(environment)$(id)</param>
</index>
<index id="sitecore_web_index" type="Sitecore.ContentSearch.Azure.CloudSearchProviderIndex, Sitecore.ContentSearch.Azure">
@martinrayenglish
martinrayenglish / CustomMongoDriverSettings.cs
Created July 8, 2018 16:16
Processor for updateMongoDriverSettings pipeline to alter MongoDB settings that are not available in the connection string
using System;
using Sitecore.Analytics.Pipelines.UpdateMongoDriverSettings;
using Sitecore.Diagnostics;
namespace MySite.Foundation.SitecoreExtensions.Pipelines.UpdateMongoDriverSettings
{
public class CustomMongoDriverSettings : UpdateMongoDriverSettingsProcessor
{
private readonly string _maxConnectionPoolSize;
@martinrayenglish
martinrayenglish / Foundation.SitecoreExtensions.config
Created July 8, 2018 16:27
Patch to add custom processor to updateMongoDriverSettings pipeline
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<updateMongoDriverSettings>
<processor type="MySite.Foundation.SitecoreExtensions.Pipelines.UpdateMongoDriverSettings.CustomMongoDriverSettings, MySite.Foundation.SitecoreExtensions">
<param desc="maxConnectionPoolSize">150</param>
<param desc="minConnectionPoolSize">20</param>
<param desc="maxConnectionIdleTimeSeconds">1500</param>
<param desc="maxConnectionLifeTimeSeconds">0</param>
</processor>
@martinrayenglish
martinrayenglish / Sitecore.Support.312397.sql
Created August 17, 2019 13:23
Stored Procedure performance issues related to SQL when querying the Sitecore Reference Data database - Sitecore.Support.312397
ALTER PROCEDURE [xdb_refdata].[DeleteDefinitions]
(
@Keys [xdb_refdata].[DefinitionKeys] READONLY
)
WITH EXECUTE AS OWNER
AS
BEGIN
SET NOCOUNT ON;
DECLARE
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:search="http://www.sitecore.net/xmlconfig/search/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement" search:require="azure">
<contentSearch>
<indexConfigurations>
<locationCloudIndexConfiguration ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration">
<documentOptions type="Sitecore.ContentSearch.DocumentBuilderOptions, Sitecore.ContentSearch">
<indexAllFields>false</indexAllFields>
<include hint="list:AddIncludedTemplate">
<locationTemplateId>{53720ED3-C9F1-494F-88D8-BF05609E79FB}</locationTemplateId>
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement" search:require="azure">
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="test_locations_web_index" type="Sitecore.ContentSearch.Azure.CloudSearchProviderIndex, Sitecore.ContentSearch.Azure">
<param desc="name">$(id)</param>
<param desc="connectionStringName">cloud.search</param>
<param desc="totalParallelServices">5</param>
@martinrayenglish
martinrayenglish / Sitecore xDB.postman_collection.json
Created June 7, 2020 13:02
Solr xDB Index Troubleshooting Postman Collection
{
"info": {
"_postman_id": "ac487bbf-4bc0-498c-9b16-034706b6fc19",
"name": "Sitecore xDB",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "xDB Contacts Count",
"request": {
@martinrayenglish
martinrayenglish / CustomXConnectDataAdapterProvider.cs
Created June 21, 2020 12:10
Sitecore xConnect XConnectDataAdapterProvider extension to only goals and other events specified in configuration
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Xml;
using Sitecore.Analytics.Model;
using Sitecore.Analytics.XConnect.DataAccess;
using Sitecore.Framework.Conditions;
using Sitecore.Xml;