5

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?

enter image description here

4 Answers 4

15

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: enter image description here

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. :-)

4
  • 3
    This 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.
    – rkallensee
    Jun 23, 2014 at 17:31
  • This is what I have expected. Thank you very much :)
    – Kalidasan
    Feb 23, 2015 at 11:32
  • 1
    Boriana, you have no idea how much you have inadvertently helped me. Can't thank you enough!!!!
    – user219492
    Aug 7, 2015 at 8:30
  • 1
    I 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.
    – TelFiRE
    Aug 29, 2015 at 8:05
1

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.

1

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.

1
  • 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.
    – Paul Moers
    Jun 4, 2015 at 20:01
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.