First, great work so far on BookStack! Recently, I encountered weird behavior of the search function, i.e., search terms are not found. In the following I list two examples for reproducing the bug:
I think I traced the problem down to app/Entity.php in function fullTextSearchQuery(...) line 188 ($search = $search->whereRaw('MATCH(' . $fields . ') AGAINST(? IN BOOLEAN MODE)', [$termString]);) where the search results are incorrectly filtered. Unfortunately, I am not sure how to fix it.
The search returns all occurrences from the search query.
The search does randomly not return all occurrences from the search query.
We've run into the same issue here. A colleague pointed it out. We have a page called: Working with GPG we can search for Working but not with or gpg.
ive noticed similar issues with symbols and 'non-words' for example in my system i use [[title to reference another page i have yet to create, or i use qq to reference a todo. neither will return any search results.
i think it might be because symbols and 'non-words' are filtered out by the preg_match_all on line 383 of app/Repos/EntityRepo.php which is where the page searches move to from the controller
Yeah. MySQL full-text search, Which I've used for speed reasons, has proved to be tricky as it tries to be clever and filter overly-common words. Plus, due to the awkward syntax I'm overly-cautiously manually escaping input going to the search which reduces many terms.
I've opened up #271 which is to look into an alternative search system.
For now, Wrapping a search in double quotes "a cat" should convert the search to an exact match which should skip the fulltext search.
Most helpful comment
We've run into the same issue here. A colleague pointed it out. We have a page called:
Working with GPGwe can search forWorkingbut notwithorgpg.