File tree Expand file tree Collapse file tree 3 files changed +22
-9
lines changed Expand file tree Collapse file tree 3 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4141- Text extraction reliability
4242- Search result context display
4343- PDF viewer integration issues
44+ - Improved Content Highlighting:
45+ - Resolved issue where similar words (e.g., "lose" instead of "Jose") were incorrectly highlighted.
46+ - Adjusted frontend logic to highlight only exact matches for search terms.
47+ - Enhanced backend query to improve precision in highlighting.
4448
4549## [ 1.1.0] - 2025-04-08
4650
Original file line number Diff line number Diff line change 5454 >
5555 🔎 View PDF at this page
5656 </a >
57- <p v-if =" result.highlight?.content "
58- class =" text-gray-600 text-sm leading-relaxed mb-3"
59- v-html =" result.highlight.content .join('...')" >
60- </p >
57+ <p v-if =" result.highlight?.text "
58+ class =" text-gray-600 text-sm leading-relaxed mb-3"
59+ v-html =" result.highlight.text .join('...')" >
60+ </p >
6161 <div class =" flex items-center space-x-3 text-sm" >
6262 <span class =" text-gray-500" >
6363 <svg class =" h-4 w-4 inline mr-1" fill =" none" stroke =" currentColor" viewBox =" 0 0 24 24" >
@@ -188,4 +188,11 @@ export default {
188188 transform: rotate (360deg );
189189 }
190190}
191+
192+ mark {
193+ background- color: yellow;
194+ color: black;
195+ padding: 0 2px ;
196+ border- radius: 2px ;
197+ }
191198< / style>
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public function search(Request $request): JsonResponse
2525 if (empty ($ query )) {
2626 return new JsonResponse ([
2727 'status ' => 'error ' ,
28- 'message ' => 'Query parameter is required ' ,
28+ 'message ' => 'Search query cannot be empty. ' ,
2929 ], Response::HTTP_BAD_REQUEST );
3030 }
3131
@@ -41,10 +41,13 @@ public function search(Request $request): JsonResponse
4141 ],
4242 'highlight ' => [
4343 'fields ' => [
44- 'text ' => new \stdClass (),
44+ 'text ' => [
45+ 'fragment_size ' => 150 ,
46+ 'number_of_fragments ' => 3 ,
47+ 'pre_tags ' => ['<mark> ' ],
48+ 'post_tags ' => ['</mark> ' ],
49+ ],
4550 ],
46- 'pre_tags ' => ['<mark> ' ],
47- 'post_tags ' => ['</mark> ' ],
4851 ],
4952 ],
5053 ];
@@ -58,7 +61,6 @@ public function search(Request $request): JsonResponse
5861 'total ' => $ results ['hits ' ]['total ' ]['value ' ] ?? 0 ,
5962 ],
6063 ]);
61-
6264 } catch (\Exception $ e ) {
6365 return new JsonResponse ([
6466 'status ' => 'error ' ,
You can’t perform that action at this time.
0 commit comments