I'm creating a custom search to my site using Views.

I want to search both nodes and users at the same time, with exposed filters like this:

[ ] events  
[ ] bands  
[ ] products  
[x] users  

But when creating views I have to specify if I want to list nodes, or users, or files etc.

How can I search through two tables at same time?

3 Answers 3


You can't really do what you ask the way views is built, not without overriding a lot of classes etc which probably would be more complex than building it all by hand.

A simple workaround would be to create two views and thus have two forms. Then you can show the form for user search when user is selected and node search when one of the node types is selected. That would also allow you to create custom filters for the user/node search, like date posted or last login.

You can use some simple JS to control hide/display of the forms.

  • +1 I have done exactly this to achieve the results, with tabs instead of check boxes but the result is the same. Jun 28, 2011 at 14:29
  • using this workaround, i'll have to create two simple forms with just one textfield in each, to put in the header of my theme, because i can't use the exposed form created by the views since it'll be too big with all the filters... how can i create this two forms? form api?
    – brunorios1
    Jun 28, 2011 at 17:40

If this is really your requirement you could do something with solr potentially. This can search different types at once as they are stored in one data source.

However this is non trivial to set up in the first instance and you would need to do a fair amount of custom coding to get it to work how you like.


There's a Drupal 5.x / Views 1.x module called "Views Union", which can combine the results of multiple Views queries. But it hasn't been touched in 3 years (and with Views 1.x, you could only query nodes, not users).

There are currently two sandbox projects for providing Views Union-like functionality:

Consider giving these a try, and providing feedback on http://drupal.org/node/1101938 and http://drupal.org/node/275162 so that one can be appointed as the successor to views_union.

Your Answer

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

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