Currently I have a bunch of exposed filters in my view but I want to combine them where I can search them using only one input field. How can this be done?
4 Answers
If you want to be super-flexible in your search, essentially searching through the whole listing rather than just a particular field or two, I'd suggest you simply add the 'Search Terms' filter.
If you go to add another filter to your view, you can narrow the options by the 'Search' related ones and select the 'Search Terms' one:
You can name it anything you want, but it will essentially search through your entries the way a regular search does - so, by default, it will search through all fields that are displayed on your node, not just the ones you're displaying in your view at the moment. Hope that makes sense - just another option to consider in the mix. :-)
-
3This search term filter is so good! The fact that it's so flexible (because of the view) and it seems to use the Drupal search index (which makes it fast) makes it a great solution. Jun 23, 2014 at 17:31
-
-
1Boriana, you have no idea how much you have inadvertently helped me. Can't thank you enough!!!! Aug 7, 2015 at 8:30
-
1I don't understand how this filter works. I have multiple nodes, all of them have the word "official" in their title, body, and multiple other fields. Yet when I search this filter for "official" there are no results.– TelFiREAug 29, 2015 at 8:05
Set your basic filters. And then add the 'global: combine fields filter'. Set it to exposed. Select the fields you want to use as filter field.
In Drupal 7, if you don't want to use any of the other module, you can use Global: Combine fields filter to get the desired functionality. By using the same, you can select multiple fields on which you want to perform search.
-
The 'global: combine fields filter' is indeed the best option, unless you want to include fields of a referenced entity or field collection. Then you need the Views filters populate module. See also my comment here. And note that when using the 'global: combine fields filter' you need to make sure to enable the core search module, or you will not find the filter Search: Search Terms option. Jun 4, 2015 at 20:01
Views filters populate module might be helpful for your issue.
This is an utility module. Its sole purpose is to fill in one blank that seems not easy to be done using normal views, which is to use one exposed string filter to search on multiple fields.
Bear in mind, that, for now, only populates STRING exposed filters, so those filters that take an array (options) or special types won't work, although it may not be difficult to extend it.
Also check this answer.