• Extensions
  • Blomstra Search, an elasticsearch fulltext search extension

HD3D no, the elastic search admin or index user.

  • HD3D replied to this.

    luceos Does it mean that I have to elastic on my server before installing this extension?

      22 days later

      Do I understand correctly that this search function does not search in discussion titles?

        luceos okay but i have some issues. for example i have a discussion with title: "Arbeitsstunden, Ferientage, Feiertage und Ferienbonus definieren".

        Now when I search for "Arbeitsstu", the discussion is suggested as a result. But as soon as I search for "Arbeitsstun" (one letter more at the end), no result is displayed.

        What could be the reason for this?

          maisen20 did you select the right language? And you might need to rerun seeding after that.

          The language is set correctly (German) and I have already deleted the index "flarum_forum" completely and created it again.

          It seems that it does not find results when my search string is longer than 10 characters.

            When i check the console i can see the request url is:

            /api/blomstra/search/discussions?filter[q]=filtervorlagen&page[limit]=3&include=mostRelevantPost

            I can't see errors in the logs and the result is:

            {"links":{"first":"https:\/\/community.domain.com\/api\/blomstra\/search\/discussions?filter%5Bq%5D=filtervorlagen\u0026page%5Blimit%5D=20\u0026include=mostRelevantPost\u0026type=discussions"},"data":[]}

              maisen20 please reach out to me on discord (my dm's are open if you joined Flarum discord) so you can share your url privately and I can take a look. That's much faster than this back and forth 😉

              To inform everyone:

              I figured out what the reason for the limitation to 10 characters is.
              In the file "/vendor/blomstra/search/src/Commands/BuildCommand.php" there are the values for 'index.max_ngram_diff' and 'max_gram' which tell ES's tokenizer how long the token can be. These values are set to 10. I assume that this is the case for all of you.

              This means words containing more than 10 characters will not be tokenized and therefore these words/posts will not be found.

              5 months later

              composer require blomstra/search:"*"

              l want install this extension but write a error words

                luceos but not understand. What is?

                Elastic Endpoint
                Username
                Password
                Index

                and not have Analyzer language : Azerbaijan

                and how to fixed size searchbox?

                  Mirzaagha Elastic Endpoint
                  Username
                  Password
                  Index

                  these are settings your elasticsearch instance has

                  Mirzaagha Azerbaijan

                  I don't know, your elastic instance probably needs to be configured with it. We currently have no flexible way to set this as a value, but you could modify the setting inside your database to the given analyzer, it might work. Otherwise a PR with the changes needed to make the field flexible would be appreciated.

                  2 months later
                  2 months later

                  @luceos I cannot get this extension work. After running the php flarum blomstra:search:index --recreate command, it seems to index everything ("Pushed a total of 5309387 into the index."), but the search results are empty. There are no errors.

                  I checked the indexes, and it looks like nothing is saved though, because the index takes up very little space and I tested it on 5 million posts.

                  ~$ curl http://localhost:9200/_cat/indices?pretty=true
                  yellow open localhost 9cVCxB2gQ6W_ZTvCMOWjvg 1 1 0 0 249b 249b 249b

                  When I run the php flarum queue:work command, there are these errors in the logs:

                  [2024-06-22 09:44:03] flarum.ERROR: Blomstra\Search\Exceptions\SeedingException: Failed to seed: Index 0 out of bounds for length 0 in /var/www/html/vendor/blomstra/search/src/Jobs/SavingJob.php:53
                  Stack trace:
                  #0 /var/www/html/vendor/illuminate/container/BoundMethod.php(36): Blomstra\Search\Jobs\SavingJob->handle(Object(Elasticsearch\Client))
                  #1 /var/www/html/vendor/illuminate/container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
                  #2 /var/www/html/vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
                  #3 /var/www/html/vendor/illuminate/container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Container\Container), Array, Object(Closure))
                  #4 /var/www/html/vendor/illuminate/container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Container\Container), Array, Array, NULL)
                  #5 /var/www/html/vendor/illuminate/bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array)
                  #6 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Blomstra\Search\Jobs\SavingJob))
                  #7 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Blomstra\Search\Jobs\SavingJob))
                  #8 /var/www/html/vendor/illuminate/bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
                  #9 /var/www/html/vendor/illuminate/queue/CallQueuedHandler.php(119): Illuminate\Bus\Dispatcher->dispatchNow(Object(Blomstra\Search\Jobs\SavingJob), false)
                  #10 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(Blomstra\Search\Jobs\SavingJob))
                  #11 /var/www/html/vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Blomstra\Search\Jobs\SavingJob))
                  #12 /var/www/html/vendor/illuminate/queue/CallQueuedHandler.php(118): Illuminate\Pipeline\Pipeline->then(Object(Closure))
                  #13 /var/www/html/vendor/illuminate/queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\RedisJob), Object(Blomstra\Search\Jobs\SavingJob))
                  #14 /var/www/html/vendor/illuminate/queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
                  #15 /var/www/html/vendor/illuminate/queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()
                  #16 /var/www/html/vendor/illuminate/queue/Worker.php(378): Illuminate\Queue\Worker->process(NULL, Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))
                  #17 /var/www/html/vendor/illuminate/queue/Worker.php(172): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), NULL, Object(Illuminate\Queue\WorkerOptions))
                  #18 /var/www/html/vendor/illuminate/queue/Console/WorkCommand.php(116): Illuminate\Queue\Worker->daemon(NULL, 'default', Object(Illuminate\Queue\WorkerOptions))
                  #19 /var/www/html/vendor/illuminate/queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand->runWorker(NULL, 'default')
                  #20 /var/www/html/vendor/illuminate/container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
                  #21 /var/www/html/vendor/illuminate/container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
                  #22 /var/www/html/vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
                  #23 /var/www/html/vendor/illuminate/container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Container\Container), Array, Object(Closure))
                  #24 /var/www/html/vendor/illuminate/container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Container\Container), Array, Array, NULL)
                  #25 /var/www/html/vendor/illuminate/console/Command.php(136): Illuminate\Container\Container->call(Array)
                  #26 /var/www/html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
                  #27 /var/www/html/vendor/illuminate/console/Command.php(120): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
                  #28 /var/www/html/vendor/symfony/console/Application.php(1058): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
                  #29 /var/www/html/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Flarum\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
                  #30 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
                  #31 /var/www/html/vendor/flarum/core/src/Console/Server.php(42): Symfony\Component\Console\Application->run()
                  #32 /var/www/html/flarum(24): Flarum\Console\Server->listen()
                  #33 {main}  

                  Elasticsearch version: 8.13.4