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

Issue with performing advanced search #63

Open
lucasfrey opened this issue Jun 30, 2020 · 2 comments
Open

Issue with performing advanced search #63

lucasfrey opened this issue Jun 30, 2020 · 2 comments

Comments

@lucasfrey
Copy link

Hi there,

Looking at the Silverstripe docs I should be able to perform this type of search using silverstripe-registry module

    private static $searchable_fields = [
        'Title'  => [
            'field' => TextField::class,
            'filter' => 'PartialMatchFilter',
         ],
        'PageType'=> [
            'field' => TextField::class,
            'filter' => 'PartialMatchFilter',
         ],
        'PublishYear'=> [
            'title' => 'Publish Year #',
            'field' => NumericField::class,
            'filter' => 'PartialMatchFilter',
        ],
        'Brochure.Title'=> [
            'field' => TextField::class,
            'filter' => 'PartialMatchFilter',
         ],
    ];

But this is throwing a [Warning] Illegal offset type in isset or empty and redirect the user back to current page without filters.

Let me know if you need more details

@robbieaverill
Copy link
Contributor

Would you mind providing a stack trace with the error message? That would show where the affected code is

@lucasfrey
Copy link
Author

Yep, here you go

Trace
Monolog\ErrorHandler->handleError(2, Illegal offset type in isset or empty, /var/www/html/vendor/silverstripe/framework/src/Control/HTTPRequest.php, 289, Array)
HTTPRequest.php:289
SilverStripe\Control\HTTPRequest->getVar(Array)
RegistryPageController.php:356
SilverStripe\Registry\RegistryPageController->queryList()
RegistryPageController.php:164
SilverStripe\Registry\RegistryPageController->RegistryEntries()
call_user_func_array(Array, Array)
ViewableData.php:485
SilverStripe\View\ViewableData->obj(RegistryEntries, , 1)
ViewableData.php:532
SilverStripe\View\ViewableData->hasValue(RegistryEntries, , 1)
SSViewer_Scope.php:323
SilverStripe\View\SSViewer_Scope->__call(hasValue, Array)
SSViewer_DataPresenter.php:309
SilverStripe\View\SSViewer_DataPresenter->__call(hasValue, Array)
.cachethemes.inz.templates.SilverStripe.Registry.Layout.RegistryPage.ss:30
include(/tmp/silverstripe-cache-php7.4.0-var-www-html/www-data/.cachethemes.inz.templates.SilverStripe.Registry.Layout.RegistryPage.ss)
SSViewer.php:602
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php7.4.0-var-www-html/www-data/.cachethemes.inz.templates.SilverStripe.Registry.Layout.RegistryPage.ss, SilverStripe\Registry\RegistryPageController, , Array, )
SSViewer.php:674
SilverStripe\View\SSViewer->process(SilverStripe\Registry\RegistryPageController, , )
SSViewerProxy.php:36
LeKoala\DebugBar\Proxy\SSViewerProxy->process(SilverStripe\Registry\RegistryPageController, )
SSViewer.php:668
SilverStripe\View\SSViewer->SilverStripe\View\{closure}()
SSViewer_DataPresenter.php:330
SilverStripe\View\SSViewer_DataPresenter->processTemplateOverride(Layout, Array)
SSViewer_DataPresenter.php:363
SilverStripe\View\SSViewer_DataPresenter->getValueSource(Layout)
SSViewer_DataPresenter.php:165
SilverStripe\View\SSViewer_DataPresenter->getInjectedValue(Layout, Array)
SSViewer_DataPresenter.php:296
SilverStripe\View\SSViewer_DataPresenter->__call(XML_val, Array)
.cachethemes.inz.templates.Page.ss:76
include(/tmp/silverstripe-cache-php7.4.0-var-www-html/www-data/.cachethemes.inz.templates.Page.ss)
SSViewer.php:602
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php7.4.0-var-www-html/www-data/.cachethemes.inz.templates.Page.ss, SilverStripe\Registry\RegistryPageController, , Array, )
SSViewer.php:674
SilverStripe\View\SSViewer->process(SilverStripe\Registry\RegistryPageController, , )
SSViewerProxy.php:36
LeKoala\DebugBar\Proxy\SSViewerProxy->process(SilverStripe\Registry\RegistryPageController)
Controller.php:300
SilverStripe\Control\Controller->handleAction(SilverStripe\Control\HTTPRequest, index)
RequestHandler.php:202
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest)
Controller.php:212
SilverStripe\Control\Controller->handleRequest(SilverStripe\Control\HTTPRequest)
ContentController.php:251
SilverStripe\CMS\Controllers\ContentController->handleRequest(SilverStripe\Control\HTTPRequest)
ModelAsController.php:101
SilverStripe\CMS\Controllers\ModelAsController->handleRequest(SilverStripe\Control\HTTPRequest)
Director.php:362
SilverStripe\Control\Director->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
VersionedHTTPMiddleware.php:41
SilverStripe\Versioned\VersionedHTTPMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
InitStateMiddleware.php:44
SilverStripe\Subsites\Middleware\InitStateMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
DebugBarMiddleware.php:17
LeKoala\DebugBar\Middleware\DebugBarMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ExecMetricMiddleware.php:20
SilverStripe\Control\Middleware\ExecMetricMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ConfirmationMiddleware.php:254
SilverStripe\Control\Middleware\ConfirmationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ConfirmationMiddleware.php:254
SilverStripe\Control\Middleware\ConfirmationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
PasswordExpirationMiddleware.php:84
SilverStripe\Security\PasswordExpirationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
BasicAuthMiddleware.php:68
SilverStripe\Security\BasicAuthMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
AuthenticationMiddleware.php:61
SilverStripe\Security\AuthenticationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
CanonicalURLMiddleware.php:190
SilverStripe\Control\Middleware\CanonicalURLMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
HTTPCacheControlMiddleware.php:42
SilverStripe\Control\Middleware\HTTPCacheControlMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
ChangeDetectionMiddleware.php:28
SilverStripe\Control\Middleware\ChangeDetectionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
FlushMiddleware.php:27
SilverStripe\Control\Middleware\FlushMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
RequestProcessor.php:66
SilverStripe\Control\RequestProcessor->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
SessionMiddleware.php:20
SilverStripe\Control\Middleware\SessionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
AllowedHostsMiddleware.php:60
SilverStripe\Control\Middleware\AllowedHostsMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
TrustedProxyMiddleware.php:176
SilverStripe\Control\Middleware\TrustedProxyMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\Director->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
Director.php:371
SilverStripe\Control\Director->handleRequest(SilverStripe\Control\HTTPRequest)
HTTPApplication.php:117
SilverStripe\Control\HTTPApplication::SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
call_user_func(Closure, SilverStripe\Control\HTTPRequest)
HTTPApplication.php:136
SilverStripe\Control\HTTPApplication->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\HTTPApplication->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
HTTPApplication.php:137
SilverStripe\Control\HTTPApplication->execute(SilverStripe\Control\HTTPRequest, Closure, )
HTTPApplication.php:116
SilverStripe\Control\HTTPApplication->handle(SilverStripe\Control\HTTPRequest)
index.php:24

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

No branches or pull requests

2 participants