From 2c900f711f1251aed6f3421bc9e1864ecae1187f Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sat, 15 May 2021 15:14:36 +0430 Subject: [PATCH] replace ZWNJ with space in search --- GanjooRazor/Pages/Search.cshtml.cs | 1 + RMuseum/Services/Implementation/GanjoorService.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/GanjooRazor/Pages/Search.cshtml.cs b/GanjooRazor/Pages/Search.cshtml.cs index 18f41133..cc7c567b 100644 --- a/GanjooRazor/Pages/Search.cshtml.cs +++ b/GanjooRazor/Pages/Search.cshtml.cs @@ -111,6 +111,7 @@ namespace GanjooRazor.Pages LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]); Query = Request.Query["s"].ApplyCorrectYeKe().Trim(); + Query = Query.Replace('‌', ' '); //replace zwnj with space PoetId = string.IsNullOrEmpty(Request.Query["author"]) ? 0 : int.Parse(Request.Query["author"]); CatId = string.IsNullOrEmpty(Request.Query["cat"]) ? 0 : int.Parse(Request.Query["cat"]); diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index 891db97b..b42ef8c2 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -1879,6 +1879,10 @@ namespace RMuseum.Services.Implementation { return new RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>((null, null), "خطای جستجوی عبارت خالی"); } + + term = term.Replace("‌", " ");//replace zwnj with space + + string searchConditions; if(term.IndexOf('"') == 0 && term.LastIndexOf('"') == (term.Length - 1)) { @@ -2060,7 +2064,7 @@ namespace RMuseum.Services.Implementation string plainText = ""; foreach (GanjoorVerse verse in verses) { - plainText += $"{verse.Text} "; + plainText += $"{verse.Text.Replace("‌", " ")} ";//replace zwnj with space } dbPoem.PlainText = plainText.Trim();