diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs
index dcba7f8a..3e298c12 100644
--- a/RMuseum/Controllers/GanjoorController.cs
+++ b/RMuseum/Controllers/GanjoorController.cs
@@ -2421,6 +2421,8 @@ namespace RMuseum.Controllers
///
///
///
+ ///
+ ///
/// return value is not complete or valid for some parts, you should use only the valid parts!
[HttpGet]
@@ -2429,9 +2431,9 @@ namespace RMuseum.Controllers
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
- public async Task 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 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);
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index c5767618..6f52f0c1 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -1671,7 +1671,7 @@
-
+
Get Similar Poems accroding to prosody and rhyme informations
@@ -1683,6 +1683,8 @@
+
+
return value is not complete or valid for some parts, you should use only the valid parts!
@@ -16151,7 +16153,7 @@
-
+
Get Similar Poems accroding to prosody and rhyme informations
@@ -16163,6 +16165,8 @@
+
+
@@ -20159,7 +20163,7 @@
-
+
Get Similar Poems accroding to prosody and rhyme informations
@@ -20171,6 +20175,8 @@
+
+
diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs
index 748d460b..804638d7 100644
--- a/RMuseum/Services/IGanjoorService.cs
+++ b/RMuseum/Services/IGanjoorService.cs
@@ -493,8 +493,10 @@ namespace RMuseum.Services
///
///
///
+ ///
+ ///
///
- Task> GetSimilarPoems(PagingParameterModel paging, string metre, string rhyme, int? poetId, int? catId, string language = "fa-IR", GanjoorPoemFormat format = GanjoorPoemFormat.Unknown, string term = null);
+ Task> 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);
///
/// language tagged poem sections
diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs
index e26f3249..68bd88d7 100644
--- a/RMuseum/Services/Implementation/GanjoorService.cs
+++ b/RMuseum/Services/Implementation/GanjoorService.cs
@@ -2547,8 +2547,10 @@ namespace RMuseum.Services.Implementation
///
///
///
+ ///
+ ///
///
- public async Task> 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> 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)