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
using System.Collections.Generic; | |
using Moriyama.Library.Architecture; | |
using Newtonsoft.Json; | |
namespace Application.Search | |
{ | |
public class VortoPropertyIndexer | |
{ | |
// Somewhere in startup | |
//ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"].GatheringNodeData += MoriyamaApplicationEventHandlerGatheringNodeData; |
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
using System.Linq; | |
using Examine; | |
using Umbraco.Core.Persistence; | |
using Umbraco.Web; | |
using UmbracoExamine; | |
namespace Moriyama.PlasterCast.Examine.Indexer | |
{ | |
public class FasterInternalIndexer : UmbracoContentIndexer | |
{ |
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
using RestSharp; | |
void ContentServicePublished(IPublishingStrategy sender, PublishEventArgs<IContent> e) | |
{ | |
foreach (var entity in e.PublishedEntities) | |
{ | |
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); | |
var url = umbracoHelper.Url(entity.Id, UrlProviderMode.Relative); | |
var urls = string.Format("https://slacker.moriyama.co.uk{0} or http://slacker.moriyama.int{0}", url); |
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
try | |
{ | |
... | |
} | |
catch (Exception ex) | |
{ | |
// Dunno why Current equals null on import but this skips the error | |
} |
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
using System.Configuration; | |
using Umbraco.Core; | |
using System.Data.SqlClient; | |
using System.Diagnostics; | |
using System.Reflection; | |
using System.Web.Configuration; | |
using Newtonsoft.Json; | |
using Umbraco.Core.Persistence; | |
using Umbraco.Core.Persistence.SqlSyntax; |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string json = | |
@"[ | |
{ | |
""X"": | |
{ |
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 void Archive(this IContent content) | |
{ | |
var h = new UmbracoHelper(UmbracoContext.Current); | |
var c = h.TypedContent(content.Id); | |
if (c != null) | |
{ | |
var u = c.Url; | |
var xml = content.ToXml(); |
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 Archive | |
{ | |
public int Id { get; set; } | |
public string Url { get; set; } | |
public string Xml { get; set; } | |
} | |
public static class PublishedContentExtensions | |
{ | |
public static void Archive(this IContent content) |
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 ArchiveContentFinder : IContentFinder | |
{ | |
public bool TryFindContent(PublishedContentRequest contentRequest) | |
{ | |
var path = contentRequest.Uri.GetAbsolutePathDecoded(); | |
var db = ApplicationContext.Current.DatabaseContext.Database; | |
var archived = db.SingleOrDefault<Archive>("select * from archive where Url = @0 or Url = @1", path, path + "/"); |
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 MyPublishedContent : PublishedContentBase | |
{ | |
public MyPublishedContent(string xml) | |
{ | |
var doc = new XmlDocument(); | |
doc.LoadXml(xml); | |
_xmlNode = doc.DocumentElement; | |
} | |
private readonly XmlNode _xmlNode; |
OlderNewer