trilbymedia / grav-plugin-tntsearch

Powerful indexed-based full text search engine powered by the TNTSearch library
https://trilby.media
MIT License
61 stars 23 forks source link

Exception when using boolean search type with inputs that contain two hyphens in one word #92

Open lukaskofi opened 4 years ago

lukaskofi commented 4 years ago

When using the boolean search type, any input that that contains a word with two or more hyphens will make the plugin throw an exception. The basic search type does not seem to be affected (ie, the exception does not occur when using search_type: basic)

As it is broken even on the official docs site, the following stacktrace is copied from there.

Whoops\Exception\ErrorException thrown with message "array_slice() expects parameter 1 to be array, string given"

Stacktrace:

#53 Whoops\Exception\ErrorException in /srv/users/serverpilot/scm/grav-plugin-tntsearch/vendor/teamtnt/tntsearch/src/Support/Collection.php:136
#52 array_slice in /srv/users/serverpilot/scm/grav-plugin-tntsearch/vendor/teamtnt/tntsearch/src/Support/Collection.php:136
#51 TeamTNT\TNTSearch\Support\Collection:slice in /srv/users/serverpilot/scm/grav-plugin-tntsearch/vendor/teamtnt/tntsearch/src/Support/Collection.php:145
#50 TeamTNT\TNTSearch\Support\Collection:take in /srv/users/serverpilot/scm/grav-plugin-tntsearch/vendor/teamtnt/tntsearch/src/TNTSearch.php:222
#49 TeamTNT\TNTSearch\TNTSearch:searchBoolean in /srv/users/serverpilot/scm/grav-plugin-tntsearch/classes/GravTNTSearch.php:130
#48 Grav\Plugin\TNTSearch\GravTNTSearch:search in /srv/users/serverpilot/scm/grav-plugin-tntsearch/tntsearch.php:226
#47 Grav\Plugin\TNTSearchPlugin:onPagesInitialized in /srv/users/serverpilot/scm/grav/vendor/symfony/event-dispatcher/EventDispatcher.php:212
#46 Symfony\Component\EventDispatcher\EventDispatcher:doDispatch in /srv/users/serverpilot/scm/grav/vendor/symfony/event-dispatcher/EventDispatcher.php:44
#45 Symfony\Component\EventDispatcher\EventDispatcher:dispatch in /srv/users/serverpilot/scm/grav/vendor/rockettheme/toolbox/Event/src/EventDispatcher.php:23
#44 RocketTheme\Toolbox\Event\EventDispatcher:dispatch in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Grav.php:400
#43 Grav\Common\Grav:fireEvent in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/PagesProcessor.php:31
#42 Grav\Common\Processors\PagesProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#41 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#40 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/TwigProcessor.php:27
#39 Grav\Common\Processors\TwigProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#38 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#37 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/AssetsProcessor.php:28
#36 Grav\Common\Processors\AssetsProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#35 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#34 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/SchedulerProcessor.php:29
#33 Grav\Common\Processors\SchedulerProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#32 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#31 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/BackupsProcessor.php:28
#30 Grav\Common\Processors\BackupsProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#29 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#28 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/TasksProcessor.php:59
#27 Grav\Common\Processors\TasksProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#26 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#25 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/RequestProcessor.php:52
#24 Grav\Common\Processors\RequestProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#23 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#22 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/ThemesProcessor.php:27
#21 Grav\Common\Processors\ThemesProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#20 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#19 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/PluginsProcessor.php:30
#18 Grav\Common\Processors\PluginsProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#17 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#16 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/InitializeProcessor.php:95
#15 Grav\Common\Processors\InitializeProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#14 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#13 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/DebuggerProcessor.php:27
#12 Grav\Common\Processors\DebuggerProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#11 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#10 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/ErrorsProcessor.php:27
#9 Grav\Common\Processors\ErrorsProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#8 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#7 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/LoggerProcessor.php:48
#6 Grav\Common\Processors\LoggerProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#5 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#4 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Processors/ConfigurationProcessor.php:28
#3 Grav\Common\Processors\ConfigurationProcessor:process in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:45
#2 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:57
#1 Grav\Framework\RequestHandler\RequestHandler:handle in /srv/users/serverpilot/scm/grav/system/src/Grav/Common/Grav.php:272
#0 Grav\Common\Grav:process in /srv/users/serverpilot/scm/grav/index.php:54
ViliusS commented 4 years ago

This is fixed now upstream.