How to configure "Quick Search" to search only certain types of objects

Users would like to use the “Quick Search” feature instead of the “Search Objects” and ave to specify the “type”.
However, would be more useful to my users if the Quick Search limited search to certain objects. Currently, it search though assets and 1 set of objects contains most of the search items so Quick Search is not useful in our case.
Any ideas on how I can configure Quick Search?
Alternatively, any ideas on how I can extend Quick Search to limit the Objects that Quick Search will search?

Maybe this event : https://github.com/pimcore/pimcore/blob/master/lib/Event/AdminEvents.php#L367 can help you.

Hi
We also want to exclude some classes from the search - either on the quick or the regular search.

We tried using this event - which was fired:
pimcore.admin.search.list.beforeFilterPrepare
But I could not figure how to set the parameter in the fired function.
Any help would be appreciated
Thanks
Eli

hi, try to modify requestParams argument ($event->getArgument(‘requestParams’))

Hi @Maksonis,
Thanks for your rapid answer.

I managed to do it successfully with:
pimcore.admin.search.list.beforeFilterPrepare

$allParams = $event->getArgument(‘requestParams’);
$allParams[‘class’] = ‘class:Car,Manufacturer’;
$event->setArgument(‘requestParams’,$allParams);

but I could not figure the parameters for the Quick Search:
pimcore.admin.quickSearch.list.beforeListLoad

$event->getArgument(‘list’)
return nothing

Any idea?

Thanks
Eli

Hi, this will do the trick

$list = $event->getArgument(‘list’);
$list->setCondition(your condition);

Hi @Maksonis,
I’m that close to the solution…

Indeed I wrote in the
pimcore.admin.quickSearch.list.beforeListLoad
method:

$list = $event->getArgument(‘list’);
$list->setCondition(‘subtype = ‘Car’’);

I even cheked the returned list on the
pimcore.admin.search.list.afterListLoad
and there was the list with the correct condition.

BUT, on the quick search on Admin there was nothing on the list
Should’nt I set back the $event object $list parameter?

$event->setArgument(‘list’,$list);

?What am I missing??

$list = $event->getArgument(‘list’);
$list->setCondition(‘subtype = ‘Car’’);

this should work

Now it works,
Thanks @Maksonis for your help!