Search not returning correct results #1701

Closed
opened 2026-02-05 01:39:38 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @ukcolumn on GitHub (May 2, 2020).

On my installation, the search function is not returning correct results. It is simply listing the content of the installation. I can search for any word that definately does not exist and it will return the same results as if I search for a term that I know exists.

I can confirm the demo instance works as expected, and that my test install on MAMP also works as expected, so this is clearly something to do with my production installation.

Steps To Reproduce
Steps to reproduce the behavior:

Perform a search.

Expected behavior
Return search results relevent to the keyword given

My Configuration:

Exact BookStack Version: BookStack v0.29.2
PHP Version: PHP 7.3.17-1+ubuntu18.04.1 (also tested with 7.1 and 7.4)
Hosting Method: Nginx/1.14.0 (Ubuntu)

Additional context

This issue arises whether searching across the installation, or within a book. I've also noticed that when I search the filter options reset as soon as I click submit but I would add that the url bar is updated, e.g. /search?term={type%3Abookshelf}.

There are no relevent errors in any of the log files. I have tried to update the search index with php artisan, but nothing changes.

This is not a bug. As I said above the demo instance works as expected, as does my test install on MAMP, so this is clearly something to do with my production installation.

Any suggestions how I might track this down much appreciated.

Originally created by @ukcolumn on GitHub (May 2, 2020). On my installation, the search function is not returning correct results. It is simply listing the content of the installation. I can search for any word that definately does not exist and it will return the same results as if I search for a term that I know exists. I can confirm the demo instance works as expected, and that my test install on MAMP also works as expected, so this is clearly something to do with my production installation. **Steps To Reproduce** Steps to reproduce the behavior: Perform a search. **Expected behavior** Return search results relevent to the keyword given **My Configuration**: Exact BookStack Version: BookStack v0.29.2 PHP Version: PHP 7.3.17-1+ubuntu18.04.1 (also tested with 7.1 and 7.4) Hosting Method: Nginx/1.14.0 (Ubuntu) **Additional context** This issue arises whether searching across the installation, or within a book. I've also noticed that when I search the filter options reset as soon as I click submit but I would add that the url bar is updated, e.g. /search?term={type%3Abookshelf}. There are no relevent errors in any of the log files. I have tried to update the search index with php artisan, but nothing changes. This is not a bug. As I said above the demo instance works as expected, as does my test install on MAMP, so this is clearly something to do with my production installation. Any suggestions how I might track this down much appreciated.
Author
Owner

@ssddanbrown commented on GitHub (May 4, 2020):

Hi @ukcolumn,
Sorry you are having trouble with this, it does sound rather odd.

Could you expand on this sentence:

I've also noticed that when I search the filter options reset as soon as I click submit but I would add that the url bar is updated, e.g. /search?term={type%3Abookshelf}.

In that scenario:

  • Does the search-bar at the top contain {type:bookshelf}?
  • Is the "Shelf" content type filter the only one checked or are they all not checked or all checked?
  • Does this occur for all filter types? Do the options get reset or do they affect the search box after clicking "Update Search"?

Any details on the production install? Operating system? Any proxies or CDN's involved? Using default system packages?

@ssddanbrown commented on GitHub (May 4, 2020): Hi @ukcolumn, Sorry you are having trouble with this, it does sound rather odd. Could you expand on this sentence: > I've also noticed that when I search the filter options reset as soon as I click submit but I would add that the url bar is updated, e.g. /search?term={type%3Abookshelf}. In that scenario: * Does the search-bar at the top contain `{type:bookshelf}`? * Is the "Shelf" content type filter the only one checked or are they all not checked or all checked? * Does this occur for all filter types? Do the options get reset or do they affect the search box after clicking "Update Search"? Any details on the production install? Operating system? Any proxies or CDN's involved? Using default system packages?
Author
Owner

@ukcolumn commented on GitHub (May 4, 2020):

No need to apologise - not your fault.

Does the search-bar at the top contain {type:bookshelf}?

No. In fact, in the process of looking closer to produce this reply I noticed that on the production box, when I search for something the resulting page returns all our content, and the search box goes blank. This is not how search behaves on my MAMP install - the search results page keeps the search term in the search box.

So, if I filter by content type, unchecking, for example, Chapter, Book and Shelf, and click on Update Search, the page returns with the same set of results and all four checkboxes are re-checked. In this case, the url string will include /search?term={type%3Apage}. If I leave Shelf as the only checked item and click Update Search, I get /search?term={type%3Abookshelf} in the url string.

That's what happens if I have a SINGLE content type checked when I click Update Search. If I have two content types selected and click Update Search, the page returns with all four content type checkboxes checked, but the url string shows /search?term=

In neither case does the filter string appear in the search box.

Any details on the production install? Operating system? Any proxies or CDN's involved? Using default system packages?

OS: Ubuntu 18.04.4 LTS, no proxies or CDNs, using default packages.

@ukcolumn commented on GitHub (May 4, 2020): No need to apologise - not your fault. > Does the search-bar at the top contain {type:bookshelf}? No. In fact, in the process of looking closer to produce this reply I noticed that on the production box, when I search for something the resulting page returns all our content, and the search box goes blank. This is not how search behaves on my MAMP install - the search results page keeps the search term in the search box. So, if I filter by content type, unchecking, for example, Chapter, Book and Shelf, and click on Update Search, the page returns with the same set of results and all four checkboxes are re-checked. In this case, the url string will include /search?term={type%3Apage}. If I leave Shelf as the only checked item and click Update Search, I get /search?term={type%3Abookshelf} in the url string. That's what happens if I have a SINGLE content type checked when I click Update Search. If I have two content types selected and click Update Search, the page returns with all four content type checkboxes checked, but the url string shows /search?term= In neither case does the filter string appear in the search box. > Any details on the production install? Operating system? Any proxies or CDN's involved? Using default system packages? OS: Ubuntu 18.04.4 LTS, no proxies or CDNs, using default packages.
Author
Owner

@ssddanbrown commented on GitHub (Jan 26, 2021):

Sorry for the lack of follow-up on this. I'm going to close this off since it's relatively old but if the below does not help, and you still have this issue, feel free to open a new issue referencing this one to continue debugging help.

I've seen similar things since in support issues here, where It sounds like the URL parameters are not reaching bookstack properly. Often it has been down to webserver configuration. If using nginx, check the try_files directive against the one here to ensure there's no missing characters.

@ssddanbrown commented on GitHub (Jan 26, 2021): Sorry for the lack of follow-up on this. I'm going to close this off since it's relatively old but if the below does not help, and you still have this issue, feel free to open a new issue referencing this one to continue debugging help. I've seen similar things since in support issues here, where It sounds like the URL parameters are not reaching bookstack properly. Often it has been down to webserver configuration. If using nginx, check the try_files directive [against the one here](https://github.com/BookStackApp/devops/blob/master/config/nginx#L11) to ensure there's no missing characters.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1701