You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got a problem while the Helper at location src/LuceneSearchBundle/Helper/HighlighterHelper.php:getHighlightedSummary($text, $queryTokens) which tries to highlight the query token in a given summary text.
The summary is tokenized into an array with separator ' ', means we have an array of all words separated by ' '. In the subsequent line 104 the if-clause checks whether the first entry of the tokenized summary array is not identical to the query token which in my case is almost always true. In this case array_slice in line 105 will cut the first and last entry of the tokenized summary array as the offset parameter is 1 and the lenght parameter is set to -1. Line 110 glues everything back together using separator ' '.
Example:
If I fed the method with
$text = "The quick brown fox jumps over the lazy dog"
$queryTokens = ["Fox"]
which resolves at line 102 to
"The quick brown fox jumps over the lazy dog" as $summary and "Fox" as $tokenInUse.
The method returns
"quick brown <span class="highlight">fox</span> jumps over the lazy
missing the first word and last word.
Can anyone please advice whether this is a bug or whether maybe I miss something?
Many thanks!
The text was updated successfully, but these errors were encountered:
awroblewski
changed the title
Cutting first word of summary while highlighting query tokens in sunnary text.
Cutting first word of summary while highlighting query tokens in summary text.
Oct 16, 2020
awroblewski
changed the title
Cutting first word of summary while highlighting query tokens in summary text.
Cutting first and last word of summary while highlighting query tokens in summary text.
Oct 16, 2020
Hello,
I got a problem while the Helper at location src/LuceneSearchBundle/Helper/HighlighterHelper.php:getHighlightedSummary($text, $queryTokens) which tries to highlight the query token in a given summary text.
Please focus line 102 - 110
The summary is tokenized into an array with separator ' ', means we have an array of all words separated by ' '. In the subsequent line 104 the if-clause checks whether the first entry of the tokenized summary array is not identical to the query token which in my case is almost always true. In this case array_slice in line 105 will cut the first and last entry of the tokenized summary array as the offset parameter is 1 and the lenght parameter is set to -1. Line 110 glues everything back together using separator ' '.
Example:
If I fed the method with
$text = "The quick brown fox jumps over the lazy dog"
$queryTokens = ["Fox"]
which resolves at line 102 to
"The quick brown fox jumps over the lazy dog" as $summary and "Fox" as $tokenInUse.
The method returns
"quick brown <span class="highlight">fox</span> jumps over the lazy
missing the first word and last word.
Can anyone please advice whether this is a bug or whether maybe I miss something?
Many thanks!
The text was updated successfully, but these errors were encountered: