Hello,

In search api views, I cannot filter with Global Php

I create basically Global Php for Filter Criteria:

return TRUE;

But it does not work.
Can anyone help me?

Thanks
John

Comments

drunken monkey’s picture

I haven't yet worked with that filter and don't know how and it what context it works – but, generally, most of Views' "Global" fields, filters, etc., are not as global as Views wants you to believe, but completely backend-dependent. That means, most of the don't work with Search API-powered views. It seem the "Global: PHP" filter is one of them.
Try putting the code into a proper filter and adding it to the search via a custom module. That is generally considered better practice, and will work in all cases.
(Or, try to debug Views to see where this goes wrong for Search API and the "Global: PHP" filter.)

johntang’s picture

@drunken monkey

Thanks for reply Drunken,

I also try debug (watchdog, drupal_set_message, Devel) on this view Global Php filter but it's not showing up any result.

Can you give me some idea for this issue?

drunken monkey’s picture

Can you give me some idea for this issue?

No, sorry, I have no idea myself. As said, I've never worked with this filter before. It seems the filter isn't called at all?
Try to ask in the Views issue queue what an alternative query plugin would have to do to get this filter to run properly, or how it works in general.

legolasbo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This issue has not seen activity in over 2,5 years. I am therefore closing this issue to clean up the issue queue. Feel free to re-open and update this issue if you feel this issue is still relevant and of importance.