Blomstra Search, an elasticsearch fulltext search extension
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?
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.
maisen20 I don't see this issue in production: https://forum.mutluanneleriz.com/?q=hastane%20%C3%A7antas%C4%B1n%C4%B1%20haz%C4%B1rlamaya%20eksik%20hep%20%C3%A7%C4%B1k%C4%B1yor%20%C3%A7%C3%BCnk%C3%BC%20birde
Can you try identifying what is sent through the Flarum api?
- Edited
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":[]}
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.
luceos Thank you. Worked
luceos but not understand. What is?
Elastic Endpoint
Username
Password
Index
and not have Analyzer language : Azerbaijan
and how to fixed size searchbox?
- Edited
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.
may be orama tool is usable for text searches. I would like to share as an option
https://docs.askorama.ai/
- Edited
@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