Sorry for the delay answering but I was trying to solve it on my own with no results.
In CCTM, the "Relational" type of Custom Field allows you to create a One-To-One or One-To-Many relation between WordPress Posts.
This is achieved by storing the related posts in the custom fields via the following syntax:
Let's say I have two custom post types: "Book" and "Writer".
I have a book post titled "The Big Story" that has a relational field called "book_writer" and a writer post called "John Doe" whose ID is 42.
Since John Doe wrote "The Big Story", I link the writer to the book via the "book_writer" field.
The content of "book_writer" field will be ["42"].
If I search "John Doe" I can get the "John Doe" post and any other post that mentions "John Doe" in its title or content but I can't get the post "The Big Story" because the field hasn't stored "John Doe" but ["42"].
Due to naming standards of the project, I cannot add the writer of the book in the title of the book post.
I edited the search.php file trying to do as follows:
1) I get the "s" variable of the query to get the keywords and save them into a $new_keywords variable.
2) If, in the results of the query, there's a post whose post_type is "writer" I catch its ID and append it to the $new_keywords variable.
3) I do a new WP_Query passing the $new_keywords variable as the "s" variable.
Unfortunately the new WP_Query returns no results.
Is there any other way to get the related posts in Relevanssi or am I getting wrong in the logic of my edit?
Hope it's more clear now and thank you