#419 search in similars page
This commit is contained in:
parent
cb394c1e62
commit
491da07dd0
@ -235,6 +235,12 @@
|
||||
|
||||
}
|
||||
</select>
|
||||
<label for="f" class="width-100per">کلیدواژه (جستجو در کل صفحهٔ شعر، برای جستجوی بهتر از <a href="/search?s=@Model.Query">صفحهٔ جستجو</a> استفاده کنید):</label>
|
||||
<input type="text" name="s" id="s" class="width-100per" value="@Model.Query" placeholder="کلیدواژه" />
|
||||
@if (Model.ExactSearch)
|
||||
{
|
||||
<input type="hidden" name="es" id="es" value="1" />
|
||||
}
|
||||
|
||||
@if(Model.CatId != 0)
|
||||
{
|
||||
@ -256,7 +262,7 @@
|
||||
@if (Model.Poems == null)
|
||||
{
|
||||
<div class="sitem">
|
||||
<p>لطفاً وزن یا قافیهٔ ابیات مد نظر را وارد کنید.</p>
|
||||
<p>لطفاً اطلاعات ورودی برای ابیات مد نظر را وارد کنید.</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
|
||||
@ -78,6 +78,9 @@ namespace GanjooRazor.Pages
|
||||
public string LastError { get; set; }
|
||||
public string Language { get; set; }
|
||||
public GanjoorPoemFormat Format { get; set; }
|
||||
public string Query { get; set; }
|
||||
public bool Quoted { get; set; }
|
||||
public bool ExactSearch { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -208,6 +211,15 @@ namespace GanjooRazor.Pages
|
||||
Format = (GanjoorPoemFormat)int.Parse(f);
|
||||
}
|
||||
|
||||
Query = Request.Query["s"].ApplyCorrectYeKe().Trim();
|
||||
ExactSearch = Request.Query["es"] == "1";
|
||||
bool quotes = Query.IndexOf("\"") != -1 || ExactSearch;
|
||||
Query = LanguageUtils.MakeTextSearchable(Query); //replace zwnj with space
|
||||
if (quotes)
|
||||
Query = $"\"{Query}\"";
|
||||
|
||||
Quoted = quotes && Query.Contains(" ");
|
||||
|
||||
|
||||
ViewData["GoogleAnalyticsCode"] = Configuration["GoogleAnalyticsCode"];
|
||||
|
||||
@ -352,7 +364,16 @@ namespace GanjooRazor.Pages
|
||||
CatFullTitle = "";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Query))
|
||||
{
|
||||
title += $" شامل کلیدواژهٔ «{Query}»";
|
||||
}
|
||||
|
||||
string url = $"{APIRoot.Url}/api/ganjoor/poems/similar?PageNumber={pageNumber}&PageSize=20&metre={Metre}&rhyme={Rhyme}&poetId={PoetId}&catId={CatId}&language={Language}&format={(int)Format}";
|
||||
if(!string.IsNullOrEmpty(Query))
|
||||
{
|
||||
url += $"&term={Query}";
|
||||
}
|
||||
var response = await _httpClient.GetAsync(url);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user