Combining multiple content types into a single search result with Drupal 6 and Views 2

Posted by Chaulky on Stack Overflow See other posts from Stack Overflow or by Chaulky
Published on 2010-04-16T03:24:13Z Indexed on 2010/04/16 3:33 UTC
Read the original article Hit count: 328

Filed under:
|
|
|

Hi all,

I need to create a somewhat advanced search functionality for my Drupal 6 site. I have a one-to-many relationship between two content types and need to search them, respecting that relationship.

To make things more clear...

I have content types TypeX and TypeY. TypeY has a node reference CCK field that relates it to a single node of TypeX. So, many nodes of TypeY reference the same node of TypeX.

I want to use Views 2 to create a search page for these nodes. I want each search result to be a node of TypeX, along with all the nodes of TypeY that reference it. I know I could just theme the individual results and use a view to add the nodes of TypeY to the single node of TypeX... but that won't allow users to actually search TypeY... it would only search TypeX and merely display some nodes of TypeY along with it.

Is there anyway to get the search to account for content in nodes of both content types, but merge the TypeY results into the "parent" node of TypeX?

In database terms, it seems like I need to do a join, then filter by the search terms. But I can't figure out how to do this in Views.

Thanks for any help i can get!!!

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-6