[PR #4202] [CLOSED] Suggestion issue fixed (#4175) #6324

Closed
opened 2026-02-05 10:29:18 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/4202
Author: @esakkiraja100116
Created: 4/26/2023
Status: Closed

Base: developmentHead: development


📝 Commits (10+)

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 app/Search/SearchRunner.php (+1 -0)

📄 Description

  1. @LHBL2003 was Identified the issue. When we give single special character, it does not provide any search result even that character is exists in the Bookstack.
  • I checked MYSQL console for why it's happening like this. So I found for that exact query. Single \ we need to give four \\\. Then only it will consider like only one.

image

  • Came back to the code

  • $inputTerm = ($inputTerm == "\\") ? str_repeat($inputTerm, 2) : $inputTerm;

  • Added condition for that backslash, then it worked.

  1. Also, I noticed that I can't able to get the word called stack and the actual word was Bookstack. So I modified that query in PHP.
  • $query->orWhere('term', 'like', $inputTerm. '%'); to $query->orWhere('term', 'like', "%$inputTerm%");

Finally, the issues are resolved 🎉

image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/4202 **Author:** [@esakkiraja100116](https://github.com/esakkiraja100116) **Created:** 4/26/2023 **Status:** ❌ Closed **Base:** `development` ← **Head:** `development` --- ### 📝 Commits (10+) - [`c418ded`](https://github.com/BookStackApp/BookStack/commit/c418ded43d6ad8b5d33d6206ccf1c35b212c503c) suggesstion issue fix (#4175) - [`a939983`](https://github.com/BookStackApp/BookStack/commit/a939983999f48bb86cb1d0e24fdcd91c67fb6a9f) suggesstion issue fix (#4175) - [`4980b93`](https://github.com/BookStackApp/BookStack/commit/4980b931ed860b770dc216a1a3002a5ab58fadf6) suggestion issue fix (#4175) - [`5713213`](https://github.com/BookStackApp/BookStack/commit/571321396a717f6b8b7b4fde5080fe319ab5a08a) suggestion issue fix (#4175) - [`9e20df6`](https://github.com/BookStackApp/BookStack/commit/9e20df6cd12d84f8b1f53c3948672c894eeb468e) search using backslash (\) - [`8ce9d69`](https://github.com/BookStackApp/BookStack/commit/8ce9d694d59e8fd9a4bea56b95f5eef2b31669c0) search using backslash (\) - [`6533a7d`](https://github.com/BookStackApp/BookStack/commit/6533a7d054734c9f48f48d9362c3ac0596ddf854) search using backslash (\) - [`8cc3370`](https://github.com/BookStackApp/BookStack/commit/8cc3370443046bfc744806f9e45c84b4ef86f0e3) Restructure - [`073d0d2`](https://github.com/BookStackApp/BookStack/commit/073d0d2b599d77dbfa59b2a9fd8052de786a46df) Error fix - [`ce8147d`](https://github.com/BookStackApp/BookStack/commit/ce8147d047a6030e20f8ac25e778256f9c56a06c) \ replaced in search ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `app/Search/SearchRunner.php` (+1 -0) </details> ### 📄 Description 1. @LHBL2003 was Identified the [issue](https://github.com/BookStackApp/BookStack/issues/4175). When we give single special character, it does not provide any search result even that character is exists in the Bookstack. - I checked MYSQL console for why it's happening like this. So I found for that exact query. Single ` \ ` we need to give four `\\\`. Then only it will consider like only one. ![image](https://user-images.githubusercontent.com/57084732/234658453-ef786963-0c5c-4dc2-858d-d0527968f9c8.png) - Came back to the [code](https://github.com/BookStackApp/BookStack/blob/development/app/Search/SearchRunner.php) - ``` $inputTerm = ($inputTerm == "\\") ? str_repeat($inputTerm, 2) : $inputTerm; ``` - Added condition for that backslash, then it worked. 2. Also, I noticed that I can't able to get the word called `stack` and the actual word was `Bookstack`. So I modified that query in PHP. - `$query->orWhere('term', 'like', $inputTerm. '%');` to `$query->orWhere('term', 'like', "%$inputTerm%");` Finally, the issues are resolved :tada: ![image](https://user-images.githubusercontent.com/57084732/234657084-456a863f-f113-419c-b460-06959494fd7e.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:29:18 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6324