Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I currently have a filter set up to search the content's body by using "contains." The problem is that this only searches the body and not the title.
Is there a way to create a single filter that searches both the body and title?
I have tried Search: Terms, but it does not have partial word searching (contains function) that I am looking for
-Thanks
Comment | File | Size | Author |
---|---|---|---|
#5 | views-combine-fields-filter.jpg | 137.88 KB | Ludo.R |
#1 | filter.views_.txt | 3.79 KB | dawehner |
Comments
Comment #1
dawehnerHere is a view which should work for you. The key for the solution of the problem is the filter: combine
Comment #3
jibranthanks for the view. I have been using this http://www.midwesternmac.com/blogs/jeff-geerling/filtersearch-multiple-f....
Comment #4
geerlingguy CreditAttribution: geerlingguy commentedI'm trying to find this filter, but can't (using Views 7.x-3.3) find it. I know I can add views and/or groups, but there's no way that I can find to combine two text fields' exposed filters (outside of a
views_query_alter()
...[Edit: Nevermind. Looks like this was added in #1421382: "Compounded Filter" - create filter for filtering several concatenated fields which, which was part of 7.x-3.4. I need to upgrade.]
Comment #5
Ludo.RHi,
I'm using Views 7.x-3.5 and try to use "Combine fields filter" on title, body and summary (which is a text field on its own).
But I don't know how to make it work. Anything that I type in the filter textfield returns all results.
It seems the keywords are not applied to the query :
Please see attached screenshot.
Any help would appreciated!
Comment #6
Ludo.RComment #7
eloiguell CreditAttribution: eloiguell commentedHi dolu,
Just add the fields you want to search to the view's Fields section, then add a 'Global: Combine fields filter' and select all the fields you want to search.
If doesn't work, remove filter first and create it.
http://www.midwesternmac.com/blogs/jeff-geerling/filtersearch-multiple-f...
Views 7.x-3.5 and Combine fields filter is great, i love it!
Comment #8
Ludo.RYes, I just found out yesterday.
Thanks for your help!
Comment #9
LTech CreditAttribution: LTech commentedI'm trying to use global:combine fields filter but what ever I put in the search just comes up with 'no results found'.
I've exposed the filter, checked 'single filter' and under 'choose field for filtering' selected just a simple title field and still it doesn't work, What am I doing wrong?
Thanks
Comment #10
jenlamptonFantastic solution, thank you! :)