stats for poems couplet counts in categories

#464
This commit is contained in:
Hamid Reza Mohammadi 2025-01-28 11:27:57 +03:30
parent a29168696c
commit 1efb4f38fb
4 changed files with 23 additions and 7 deletions

View File

@ -2421,6 +2421,8 @@ namespace RMuseum.Controllers
/// <param name="language"></param>
/// <param name="format"></param>
/// <param name="term"></param>
/// <param name="coupletCountsFrom"></param>
/// <param name="coupletCountsTo"></param>
/// <returns>return value is not complete or valid for some parts, you should use only the valid parts!</returns>
[HttpGet]
@ -2429,9 +2431,9 @@ namespace RMuseum.Controllers
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<GanjoorPoemCompleteViewModel>))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
public async Task<IActionResult> GetSimilarPoems([FromQuery] PagingParameterModel paging, string metre, string rhyme, int poetId = 0, int catId = 0, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null)
public async Task<IActionResult> GetSimilarPoemsAsync([FromQuery] PagingParameterModel paging, string metre, string rhyme, int poetId = 0, int catId = 0, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null, int coupletCountsFrom = 0, int coupletCountsTo = 0)
{
var pagedResult = await _ganjoorService.GetSimilarPoems(paging, metre, rhyme, poetId == 0 ? null : poetId, catId == 0 ? null : catId, language, format, term);
var pagedResult = await _ganjoorService.GetSimilarPoemsAsync(paging, metre, rhyme, poetId == 0 ? null : poetId, catId == 0 ? null : catId, language, format, term, coupletCountsFrom, coupletCountsTo);
if (!string.IsNullOrEmpty(pagedResult.ExceptionString))
return BadRequest(pagedResult.ExceptionString);

View File

@ -1671,7 +1671,7 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetSimilarPoems(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.String,System.Int32,System.Int32,System.String,RMuseum.Models.Ganjoor.GanjoorPoemFormat,System.String)">
<member name="M:RMuseum.Controllers.GanjoorController.GetSimilarPoemsAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.String,System.Int32,System.Int32,System.String,RMuseum.Models.Ganjoor.GanjoorPoemFormat,System.String,System.Int32,System.Int32)">
<summary>
Get Similar Poems accroding to prosody and rhyme informations
</summary>
@ -1683,6 +1683,8 @@
<param name="language"></param>
<param name="format"></param>
<param name="term"></param>
<param name="coupletCountsFrom"></param>
<param name="coupletCountsTo"></param>
<returns>return value is not complete or valid for some parts, you should use only the valid parts!</returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetLanguageTaggedPoemSections(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Int32)">
@ -16151,7 +16153,7 @@
<param name="paging"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetSimilarPoems(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String,RMuseum.Models.Ganjoor.GanjoorPoemFormat,System.String)">
<member name="M:RMuseum.Services.IGanjoorService.GetSimilarPoemsAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String,RMuseum.Models.Ganjoor.GanjoorPoemFormat,System.String,System.Int32,System.Int32)">
<summary>
Get Similar Poems accroding to prosody and rhyme informations
</summary>
@ -16163,6 +16165,8 @@
<param name="language"></param>
<param name="format"></param>
<param name="term"></param>
<param name="coupletCountsFrom"></param>
<param name="coupletCountsTo"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetLanguageTaggedPoemSections(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Nullable{System.Int32})">
@ -20159,7 +20163,7 @@
<param name="recitation"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetSimilarPoems(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String,RMuseum.Models.Ganjoor.GanjoorPoemFormat,System.String)">
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetSimilarPoemsAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String,RMuseum.Models.Ganjoor.GanjoorPoemFormat,System.String,System.Int32,System.Int32)">
<summary>
Get Similar Poems accroding to prosody and rhyme informations
</summary>
@ -20171,6 +20175,8 @@
<param name="format"></param>
<param name="catId"></param>
<param name="term"></param>
<param name="coupletCountsFrom"></param>
<param name="coupletCountsTo"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetLanguageTaggedPoemSections(RSecurityBackend.Models.Generic.PagingParameterModel,System.String,System.Nullable{System.Int32})">

View File

@ -493,8 +493,10 @@ namespace RMuseum.Services
/// <param name="language"></param>
/// <param name="format"></param>
/// <param name="term"></param>
/// <param name="coupletCountsFrom"></param>
/// <param name="coupletCountsTo"></param>
/// <returns></returns>
Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> GetSimilarPoems(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null);
Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> GetSimilarPoemsAsync(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null, int coupletCountsFrom = 0, int coupletCountsTo = 0);
/// <summary>
/// language tagged poem sections

View File

@ -2547,8 +2547,10 @@ namespace RMuseum.Services.Implementation
/// <param name="format"></param>
/// <param name="catId"></param>
/// <param name="term"></param>
/// <param name="coupletCountsFrom"></param>
/// <param name="coupletCountsTo"></param>
/// <returns></returns>
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> GetSimilarPoems(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null)
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>> GetSimilarPoemsAsync(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null, int coupletCountsFrom = 0, int coupletCountsTo = 0)
{
if (poetId == null)
{
@ -2597,6 +2599,10 @@ namespace RMuseum.Services.Implementation
&&
(catId == null || catIdList.Contains(s.Poem.CatId))
&&
(s.CoupletsCount >= coupletCountsFrom)
&&
(coupletCountsTo == 0 || s.CoupletsCount <= coupletCountsTo)
&&
(searchConditions == "" || (searchConditions != "" && EF.Functions.Contains(s.Poem.PlainText, searchConditions)))
)
.OrderBy(p => p.Poet.BirthYearInLHijri).ThenBy(p => p.Poet.Nickname).ThenBy(p => p.SectionType).ThenBy(p => p.Poem.Id)