highlighting search terms now highlights the whole expression in exact search mode

This commit is contained in:
Hamid Reza Mohammadi 2021-05-26 18:52:33 +04:30
parent 1d9d1317c5
commit a70bf789b4

View File

@ -141,9 +141,14 @@ namespace GanjooRazor.Pages
if(Poems != null)
{
// highlight searched word
string[] queryParts = Query.IndexOf('"') == 0 && Query.LastIndexOf('"') == (Query.Length - 1) ?
new string[] { Query.Replace("\"", "") }
:
Query.Replace("\"", "").Split(' ', StringSplitOptions.RemoveEmptyEntries);
foreach (var poem in Poems)
{
string[] queryParts = Query.Replace("\"", "").Split(' ', StringSplitOptions.RemoveEmptyEntries);
int firstIndex = poem.PlainText.Length;
for (int i = 0; i < queryParts.Length; i++)