From 792fc77870ded61333e2cb0d2aa35438e9d4da8f Mon Sep 17 00:00:00 2001 From: Harjot Singh Date: Mon, 29 Jun 2020 13:42:37 +0100 Subject: [PATCH] fix(frontend/controller): use original line to render search results --- app/frontend/src/Controller/Search.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/frontend/src/Controller/Search.js b/app/frontend/src/Controller/Search.js index 5fcc98f0..6c753b0e 100644 --- a/app/frontend/src/Controller/Search.js +++ b/app/frontend/src/Controller/Search.js @@ -75,20 +75,19 @@ const highlightFullWordMatches = ( line, query ) => { } const highlightFirstLetterMatches = ( line, query ) => { - const unicodeLine = stripAccents( stripVishraams( toUnicode( line ) ) ) - const unicodeQuery = stripAccents( toUnicode( query ) ) + const baseLine = stripVishraams( line ) - const letters = firstLetters( unicodeLine ) - const words = unicodeLine.split( ' ' ) + const letters = toAscii( firstLetters( stripAccents( toUnicode( baseLine ) ) ) ) + const words = baseLine.split( ' ' ) - const startPosition = letters.search( unicodeQuery ) + const startPosition = letters.search( stripAccents( query ) ) const endPosition = startPosition + query.length return [ `${words.slice( 0, startPosition ).join( ' ' )} `, `${words.slice( startPosition, endPosition ).join( ' ' )} `, `${words.slice( endPosition ).join( ' ' )} `, - ].map( toAscii ) + ] } /**