Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lukaskofi opened this issue Feb 19, 2020 · 1 comment
Labels

Comments

@lukaskofi
Copy link

lukaskofi commented Feb 19, 2020

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
@mahagr mahagr added the bug label Feb 24, 2020
ViliusS added a commit to ViliusS/tntsearch that referenced this issue Oct 26, 2020
This patch changes two things:
1) When using custom Tokenizer, enables searching for UUIDs, product names and other items with dashes in their names by counting only space and dash character as an expression instead of just dash (see:
teamtnt#161, teamtnt#215, trilbymedia/grav-plugin-tntsearch#92)
2) In some sense it partialy reverts teamtnt@33cc524 as email address parts are broken into tokens in the default Tokenizer anyway.
@ViliusS
Copy link
Contributor

ViliusS commented Nov 12, 2020

This is fixed now upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants