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!!!
'** EDIT '**
To make sure this is clear, here's a visual example of what I'm trying to do...
_____________________________________________________________________________________
|Type X Node |Type Y Node |
| | |
| Content in node of TypeX that gets |Has a node reference that points to the node |
| searched by the view... |of TypeX. This content gets searched too! |
| |_____________________________________________|
| |Type Y Node |
| | |
| |Another TypeY node with a node reference to |
| |to the TypeX node. This gets searched too! |
--------------------------------------------------------------------------------------
This would be a single result from the search View. They content in all three nodes would be considered by the Search : Terms filter in the view. So if I searched for "This gets searched too!", I would get the above result. Or, if I searched "Content in node of TypeX", I'd get the same search result above.
I know I could search for TypeX and load up the TypeY nodes in the result display using another view, but it wouldn't search the content in the TypeY nodes.
Any ideas... short of rolling my own search functionality (not something I'd like to do at the moment)?