1

I'm using Views in Drupal.

I want an exposed filter selecting the ndoes containing a specific word. But I noticed I cannot search more then one CCK field per filter.

Since I want to expose it, I want an unique text-input field for all CCK Fields: is that possible ?

At the moment I can only add a new filter for each CCK field.

Thanks

vfilby
  • 9,938
  • 9
  • 49
  • 62
aneuryzm
  • 63,052
  • 100
  • 273
  • 488

3 Answers3

2

You can use the CCK module Computed Field.

Setup the field so that it stores all the text from all the other fields, then you can filter on this one field (and effectively filter on all fields).

See this code snippet for merging multiple fields into one.

vfilby
  • 9,938
  • 9
  • 49
  • 62
  • so, the only solution is to add another CCK field to my nodes and use php to copy all the content there ? – aneuryzm Apr 23 '10 at 17:43
  • There could be a better solution, but I am not aware of it. What you are doing seems really close to search, is there any reason you don't want to use the built in search or some of the better search modules out there? – vfilby Apr 23 '10 at 17:47
  • yeah I could maybe use search. I'm using a personalized View in my website and added to it some javascript functionalities, so I guess if i run Search I'm going to use another View.. that's the main reason. – aneuryzm Apr 23 '10 at 17:49
  • 1
    If this is just search, I would suggest trying to use the core search module (or one of the other feature rich search modules) rather than trying to duplicate it with views. Performance will be much better with proper search. – vfilby Apr 23 '10 at 17:54
  • ok cool, so I should work on the code, or find some module to customize search view. thanks – aneuryzm Apr 23 '10 at 18:49
  • yeah ok, but I need to customize the search results like my view. I guess this is double work.. – aneuryzm Apr 23 '10 at 19:15
1

I've actually found the item "Search" in my Filters options in Views. I dunno how I could ignored it before. It actually exists, and works quite well. Solved.

aneuryzm
  • 63,052
  • 100
  • 273
  • 488
  • 1
    For Drupal 7 users, it is located in Views under Filter criteria -> Filter -> Global: Combine fields filter. Then you select the multiple fields from the Fields section of Views. – user785179 Nov 07 '12 at 23:35
0

Here is the discussion. http://drupal.org/node/451000

Drupal 6 solution - Comment #16

Drupal 7 solution

Previous solution can be used to Drupal 7 but there is one module you can use http://drupal.org/project/views_filters_populate

Great module. But there is 1 problem "only populates STRING exposed filters"

milkovsky
  • 8,772
  • 4
  • 28
  • 32