Option to disable the search index via the config file #10142
Answered
by
brandonkelly
alexanderloewe
asked this question in
Ideas
-
We have a medium size site with about 500 entries, but the search index has a size of 150 MB in the database. At the moment we do not use any search function on the frontend, so i'd likt to disable the building of a search index into the db. |
Beta Was this translation helpful? Give feedback.
Answered by
brandonkelly
Nov 23, 2021
Replies: 1 comment 4 replies
-
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
brandonkelly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can prevent elements’ search keywords from getting indexed using the
craft\services\Elements::EVENT_BEFORE_UPDATE_SEARCH_INDEX
event. Add this code to your module:Note that this will also affect the search bar above element indexes within the control panel, which will likely frustrate authors, so not recommended.
Instead of disabling element keyword indexing altogether, you can prevent all custom fields from getting indexed, which will reduce …