Make Reused Page Content Searchable #1107

Closed
opened 2026-02-04 23:48:17 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @nvnvnvnvn on GitHub (Mar 23, 2019).

Describe the feature you'd like
Make "shared content" searchable in the pages they are shared in.

Let's say I have a page titled "washing dishes". This will be the content I want to share, or reuse, in other pages such as "making breakfast" and "making dinner". Currently if I search for "washing dishes", only the "washing dishes" page shows up. Would like to have it also find the other pages as well....and better still if that is an "option/filter" setting in the searches if you want to include it or not.

Describe the benefits this feature would bring to BookStack users
If I am searching "how to run a cafe efficiently" book for washing dishes, it will not return the making breakfast or making dinner pages in that book. My example is poor for actual usage/need but we have content shared between multiple books but the user search in the book becomes no results and in the global search becomes insufficient result (only the shared content page, but it is missing the page we actually want them to find).

Additional context
Regarding Reusing Page Content:
https://www.bookstackapp.com/docs/user/reusing-page-content/

Originally created by @nvnvnvnvn on GitHub (Mar 23, 2019). **Describe the feature you'd like** Make "shared content" searchable in the pages they are shared in. Let's say I have a page titled "washing dishes". This will be the content I want to share, or reuse, in other pages such as "making breakfast" and "making dinner". Currently if I search for "washing dishes", only the "washing dishes" page shows up. Would like to have it also find the other pages as well....and better still if that is an "option/filter" setting in the searches if you want to include it or not. **Describe the benefits this feature would bring to BookStack users** If I am searching "how to run a cafe efficiently" book for washing dishes, it will not return the making breakfast or making dinner pages in that book. My example is poor for actual usage/need but we have content shared between multiple books but the user search in the book becomes no results and in the global search becomes insufficient result (only the shared content page, but it is missing the page we actually want them to find). **Additional context** Regarding Reusing Page Content: https://www.bookstackapp.com/docs/user/reusing-page-content/
OVERLORD added the 🛠️ Enhancement🔒 Security🏭 Back-End labels 2026-02-04 23:48:17 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Mar 24, 2019):

Thanks for the suggestion @nvnvnvnvn.

This actually used to be a feature but I removed it since it allowed the included content to be visible to those without permission to view the included item.

This will be difficult to do while full conforming to the permission system. Maybe a halfway-solution if make the included content indexed if visible to the guest user? Not ideal though as we'll have to re-index or having warnings to re-index when changes are made to guest user permissions.

@ssddanbrown commented on GitHub (Mar 24, 2019): Thanks for the suggestion @nvnvnvnvn. This actually used to be a feature but I removed it since it allowed the included content to be visible to those without permission to view the included item. This will be difficult to do while full conforming to the permission system. Maybe a halfway-solution if make the included content indexed if visible to the guest user? Not ideal though as we'll have to re-index or having warnings to re-index when changes are made to guest user permissions.
Author
Owner

@nvnvnvnvn commented on GitHub (Mar 25, 2019):

Thanks @ssddanbrown , that does seem like a challenge. I was thinking if it is in a page that someone has permissions to view they should be able to view everything. But, I can see where someone may want to have content in a page that only certain people can view that particular section/content of the page.

Interesting situation. Could it be a global setting so we could choose to show it and others could choose to not?

@nvnvnvnvn commented on GitHub (Mar 25, 2019): Thanks @ssddanbrown , that does seem like a challenge. I was thinking if it is in a page that someone has permissions to view they should be able to view everything. But, I can see where someone may want to have content in a page that only certain people can view that particular section/content of the page. Interesting situation. Could it be a global setting so we could choose to show it and others could choose to not?
Author
Owner

@ssddanbrown commented on GitHub (Nov 8, 2022):

I'm going to go ahead and close this off since it's had no additional demand so I don't see it worth maintaining such an option.

I think this is just one boolean to change in the code though, so it you wanted a pointer to what to tweak so you could maintain your own patch, just shout.

@ssddanbrown commented on GitHub (Nov 8, 2022): I'm going to go ahead and close this off since it's had no additional demand so I don't see it worth maintaining such an option. I think this is just one boolean to change in the code though, so it you wanted a pointer to what to tweak so you could maintain your own patch, just shout.
Author
Owner

@pankaz commented on GitHub (Feb 3, 2023):

Hi @ssddanbrown. First and foremost. Thank you for building such a wonderful and powerful tool over the years.

I'm trying to enable this feature in this custom fork (https://github.com/Shreemeera-Foundation/bookstack-smf-replica) of the project. Can you please share how can I enable the said feature?

Thank you in advance.

@pankaz commented on GitHub (Feb 3, 2023): Hi @ssddanbrown. First and foremost. Thank you for building such a wonderful and powerful tool over the years. I'm trying to enable this feature in this custom fork (https://github.com/Shreemeera-Foundation/bookstack-smf-replica) of the project. Can you please share how can I enable the said feature? Thank you in advance.
Author
Owner

@ssddanbrown commented on GitHub (Feb 3, 2023):

@pankaz Might be more that one boolean change looking at this now, but not diven too deep into it. The page content terms are generated here. It's be a case of altering that line to run the provided HTML through this function first.

Note, this can have side affects when permissions/visibility-control is at play in an instance.

@ssddanbrown commented on GitHub (Feb 3, 2023): @pankaz Might be more that one boolean change looking at this now, but not diven too deep into it. The page content terms are [generated here](https://github.com/Shreemeera-Foundation/bookstack-smf-replica/blob/8367a94e90e5e1bf7d06defe30d570ade2f00599/app/Search/SearchIndex.php#L228). It's be a case of altering that line to run the provided HTML through [this function first](https://github.com/Shreemeera-Foundation/bookstack-smf-replica/blob/8367a94e90e5e1bf7d06defe30d570ade2f00599/app/Entities/Tools/PageContent.php#L287). Note, this can have side affects when permissions/visibility-control is at play in an instance.
Author
Owner

@pankaz commented on GitHub (Feb 8, 2023):

Hi @ssddanbrown, thank you so much for pointing us in the right direction. I appreciate your quick reply and guidance. We achieved the expected result by tweaking the parsePageIncludes method and reindexing the search terms.

@pankaz commented on GitHub (Feb 8, 2023): Hi @ssddanbrown, thank you so much for pointing us in the right direction. I appreciate your quick reply and guidance. We achieved the expected result by tweaking the `parsePageIncludes` method and reindexing the search terms.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1107