From fcaded0ae0d81d080d314c5da6c461f96261441e Mon Sep 17 00:00:00 2001 From: bkapustik <82807109+bkapustik@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:26:55 +0200 Subject: [PATCH] refactor(docs): change "" to string.Empty --- docs/Custom-index-strategy.md | 10 +++++----- docs/Scraping-web-page-content.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/Custom-index-strategy.md b/docs/Custom-index-strategy.md index 9de5446..c902d9e 100644 --- a/docs/Custom-index-strategy.md +++ b/docs/Custom-index-strategy.md @@ -42,7 +42,7 @@ public class ExampleSearchIndexingStrategy : DefaultAlgoliaIndexingStrategy { var result = new List(); - string title = ""; + string title = string.Empty; // IIndexEventItemModel could be a reusable content item or a web page item, so we use // pattern matching to get access to the web page item specific type and fields @@ -96,11 +96,11 @@ Some properties of the `IIndexEventItemModel` are added to the JObjects by defau public class AlgoliaSearchResultModel { // This field is defaultly only added to the document if the indexed item is a web page. - public string Url { get; set; } = ""; - public string ContentTypeName { get; set; } = ""; - public string LanguageName { get; set; } = ""; + public string Url { get; set; } = string.Empty; + public string ContentTypeName { get; set; } = string.Empty; + public string LanguageName { get; set; } = string.Empty; public Guid ItemGuid { get; set; } - public string ObjectID { get; set; } = ""; + public string ObjectID { get; set; } = string.Empty; } ``` diff --git a/docs/Scraping-web-page-content.md b/docs/Scraping-web-page-content.md index 43fccab..87858d2 100644 --- a/docs/Scraping-web-page-content.md +++ b/docs/Scraping-web-page-content.md @@ -47,7 +47,7 @@ public class WebCrawlerService ex, $"Tree Path: {page.SystemFields.WebPageItemTreePath}"); } - return ""; + return string.Empty; } public async Task CrawlPage(string url) @@ -65,7 +65,7 @@ public class WebCrawlerService ex, $"Url: {url}"); } - return ""; + return string.Empty; } } ``` @@ -126,8 +126,8 @@ public class WebScraperHtmlSanitizer textContent = HTMLHelper.RegexHtmlToTextWhiteSpace.Replace(textContent, " "); textContent = textContent.Trim(); - string title = doc.Head?.QuerySelector("title")?.TextContent ?? ""; - string description = doc.Head?.QuerySelector("meta[name='description']")?.GetAttribute("content") ?? ""; + string title = doc.Head?.QuerySelector("title")?.TextContent ?? string.Empty; + string description = doc.Head?.QuerySelector("meta[name='description']")?.GetAttribute("content") ?? string.Empty; return string.Join( " ", @@ -179,7 +179,7 @@ public override async Task> MapToAlgoliaJObjectsOrNull(IInd { // ... - string content = ""; + string content = string.Empty; if (item is IndexEventWebPageItemModel webpageItem && string.Equals(indexedModel.ContentTypeName, ArticlePage.CONTENT_TYPE_NAME, StringComparison.OrdinalIgnorecase))