Searching for CJK works only with keywords that put inside quotation marks #2258

Closed
opened 2026-02-05 03:28:50 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @dgwxx on GitHub (May 21, 2021).

Describe the bug
Searching for CJK works only with keywords that put inside quotation marks

Steps To Reproduce
I added some text in CJK like '一部販売店がHGST製品に対して Seagate の同等製品',

  • tried to search for 'HGST' -> No matches
  • tried to search for '"HGST"' -> 1 match
  • tried to search for 'Seagate' -> 1 match
  • tried to search for '販売店' -> No matches
  • tried to search for '"販売店"' -> 1 match

Expected behavior
To match the keywords without quotation marks.

Your Configuration (please complete the following information):

  • BookStack v21.04.5
  • MariaDB 10.4.19
  • Apache/2.4.47 (Win64)
  • PHP/8.0.6

I checked the source code in BookStack/app/Entities/Tools/SearchRunner.php and I find the code near line 152
$query->orWhere('term', 'like', $inputTerm .'%');
the '%' is not in pairs. I fixed this code, and all keyword can be matched.
$query->orWhere('term', 'like', '%'. $inputTerm .'%');

Originally created by @dgwxx on GitHub (May 21, 2021). **Describe the bug** Searching for CJK works only with keywords that put inside quotation marks **Steps To Reproduce** I added some text in CJK like '一部販売店がHGST製品に対して Seagate の同等製品', - tried to search for 'HGST' -> No matches - tried to search for '"HGST"' -> 1 match - tried to search for 'Seagate' -> 1 match - tried to search for '販売店' -> No matches - tried to search for '"販売店"' -> 1 match **Expected behavior** To match the keywords without quotation marks. **Your Configuration (please complete the following information):** - BookStack v21.04.5 - MariaDB 10.4.19 - Apache/2.4.47 (Win64) - PHP/8.0.6 I checked the source code in BookStack/app/Entities/Tools/SearchRunner.php and I find the code near line 152 `$query->orWhere('term', 'like', $inputTerm .'%');` the '%' is not in pairs. I fixed this code, and all keyword can be matched. `$query->orWhere('term', 'like', '%'. $inputTerm .'%');`
OVERLORD added the :cat2:🐈 Possible duplicate label 2026-02-05 03:28:50 +03:00
Author
Owner

@ssddanbrown commented on GitHub (May 23, 2021):

Thanks for raising @dgwxx.
This is a known issue and already open under issues #1037 and #778 so I'm therefore going to close this off as a duplicate.

@ssddanbrown commented on GitHub (May 23, 2021): Thanks for raising @dgwxx. This is a known issue and already open under issues #1037 and #778 so I'm therefore going to close this off as a duplicate.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2258