Don’t use ‘q’ as the Filter identifier in Drupal views

Seriously, it will drive you mad.

If you ever want to waste two hours of your life, try changing the filter identifier parameter in views to ‘q’.

The filter identifier is the part of an exposed filter in Views that determines what the filter’s parameter in the URL is (the ‘q’ in ?q=search+term). I was trying to set up a view using the search API and didn’t want the long and ugly default parameter so I changed it to ‘q’ (as part of a lot of configuration) and then spent two hours trying to figure out why the view wasn’t working.

It took a process of elimination and then remembering that Drupal uses the ‘?q=’ parameter internally for URLs before I figured it out.

The error you get is that you get two textfield inputs (when you should only have one) and the search doesn’t affect results.


You May Also Like