Search provides an elasticsearch powered fulltext, drop-in search solution for Flarum. It is deemed of value for growing communities that need better search results than what vanilla can offer.
Why is this not part of core?
For small communities the usual MySQL fulltext search suffices. Once you install this extension things soon blow up, how?
- A queue is recommended, for instance the database queue driver. You'll need this to delegate the seeding of post content to elastic. If you don't do this, the end user experience can be severely impacted with increased latency.
- You will need to run elastic search, which in a meager form already requires at least more than one full vCPU and a few GB of memory.
So when do you need this? When you notice that your users have a hard time finding matches to key searches. If, to you, it is obvious a result should have been there, but vanilla Flarum throws other random things into the search results.
Installation
You will need php 8+ to install this extension.
composer require blomstra/search:"*"
Go to your admin area, enable the extension and fill in the required elasticsearch information.
Next, go to your commandline and do a first index of existing posts using the command:
php flarum blomstra:search:index --recreate
This will create the field mapping required in elastic and will push indexing of discussions/posts to the queue. If you have no queue driver installed (I recommend you do), the indexing starts in the same process.
Command options
The blomstra:search:index
can do more things:
--throttle=n
allows throttling of indexing, where n
is the number of seconds.
--only=posts
allows indexing only posts
or discussions
--continue
allows you to continue where you left off if you stop the process
FAQ
Can I commission a feature for this extensions?
We would gladly take care of any commissions for this extension, or review any pull request made by any other developer to the target repository.
Reach out to us via https://helpdesk.blomstra.net. We will get back to you as soon as we can.