From 9db3a30d862138c76dc26fa4e7f3526df974d58a Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Thu, 6 Mar 2025 12:06:12 +0330 Subject: [PATCH] comparison of usage stats of a selected word among all poets #471 --- GanjooRazor/Pages/Search.cshtml | 25 ++++++++++++++----- GanjooRazor/Pages/Search.cshtml.cs | 17 ++++++++++++- .../Pages/_WordCountsByPoetPartial.cshtml | 2 +- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/GanjooRazor/Pages/Search.cshtml b/GanjooRazor/Pages/Search.cshtml index 59a51799..0d4f2af5 100644 --- a/GanjooRazor/Pages/Search.cshtml +++ b/GanjooRazor/Pages/Search.cshtml @@ -41,6 +41,7 @@ window.location.href = currentUrl.toString(); } + @@ -203,12 +204,16 @@ else { -
- - بسامد واژگان به تفکیک سخنور - - -
+ @if(Model.QueryIsSingleWord) + { +
+ + مشاهدهٔ بسامد واژگان «@Model.Query» به تفکیک سخنور + + +
+ } + for (int poemIndex = 0; poemIndex < Model.Poems.Count; poemIndex++) { @@ -279,6 +284,14 @@ } } + @if (Model.QueryIsSingleWord) + { + + } + + diff --git a/GanjooRazor/Pages/Search.cshtml.cs b/GanjooRazor/Pages/Search.cshtml.cs index 426cf8ef..fb9d78b0 100644 --- a/GanjooRazor/Pages/Search.cshtml.cs +++ b/GanjooRazor/Pages/Search.cshtml.cs @@ -13,7 +13,6 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using RMuseum.Models.Ganjoor; using RMuseum.Models.Ganjoor.ViewModels; using RMuseum.Services.Implementation; using RSecurityBackend.Models.Generic; @@ -69,6 +68,14 @@ namespace GanjooRazor.Pages public List Poets { get; set; } public string Query { get; set; } + + public bool QueryIsSingleWord + { + get + { + return !string.IsNullOrEmpty(Query) && Query.IndexOfAny([' ', '‌']) == -1; + } + } public int PoetId { get; set; } public int CatId { get; set; } public string CatFullTitle { get; set; } @@ -153,6 +160,14 @@ namespace GanjooRazor.Pages public bool ExactSearch { get; set; } + public string QueryDin + { + get + { + return Request.Query["s"].ApplyCorrectYeKe().Trim(); + } + } + public async Task OnGetAsync() { if (bool.Parse(Configuration["MaintenanceMode"])) diff --git a/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml b/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml index 78655f0d..e4ac465a 100644 --- a/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml +++ b/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml @@ -5,7 +5,7 @@ @if (Model.WordStats.Length > 0) {

- این واژه در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats.Sum(w => w.Count)) بار در گنجور ظاهر شده است که سهم هر سخنور در جدول زیر مشخص شده است. + «@Model.Term» در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats.Sum(w => w.Count)) بار در گنجور ظاهر شده است که سهم هر سخنور در جدول زیر مشخص شده است.