Skip to content

Commit

Permalink
refactor(docs): change "" to string.Empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bkapustik committed Aug 26, 2024
1 parent d6f35b5 commit fcaded0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions docs/Custom-index-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ExampleSearchIndexingStrategy : DefaultAlgoliaIndexingStrategy
{
var result = new List<JObject>();

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
Expand Down Expand Up @@ -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;
}
```

Expand Down
10 changes: 5 additions & 5 deletions docs/Scraping-web-page-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class WebCrawlerService
ex,
$"Tree Path: {page.SystemFields.WebPageItemTreePath}");
}
return "";
return string.Empty;
}

public async Task<string> CrawlPage(string url)
Expand All @@ -65,7 +65,7 @@ public class WebCrawlerService
ex,
$"Url: {url}");
}
return "";
return string.Empty;
}
}
```
Expand Down Expand Up @@ -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(
" ",
Expand Down Expand Up @@ -179,7 +179,7 @@ public override async Task<IEnumerable<JObject>> MapToAlgoliaJObjectsOrNull(IInd
{
// ...
string content = "";
string content = string.Empty;

if (item is IndexEventWebPageItemModel webpageItem &&
string.Equals(indexedModel.ContentTypeName, ArticlePage.CONTENT_TYPE_NAME, StringComparison.OrdinalIgnorecase))
Expand Down

0 comments on commit fcaded0

Please sign in to comment.