Hi dannybatista,
It took me a while, but I found no really suitable solution with the P2P and the advanced search combined. As a solution, I’ve build an indexer that loops through the posts, and replaces the titles with the meta values.
I believe this solution is better in the end for our cause because the speed of the search (through already 2000 posts, is within 2 seconds). When using search everything plugin combined with P2P, a search took me 26 seconds. Not usable for my clients of course.
Here is the core code of the indexer, I’ve build this as a custom plugin, with its own admin page.
public function startIndex(){
$args = array(
'post_type' => 'studenten',
'post_status' => 'publish',
'posts_per_page' => 100,
'offset' => 0,
);
query_posts( $args );
if(have_posts()) :
while (have_posts()) : the_post();
$meta_voornaam = get_post_meta(get_the_id(), '_persoonsgegevens_voornaam');
$meta_achternaam = get_post_meta(get_the_id(), '_persoonsgegevens_achternaam');
$meta_email = get_post_meta(get_the_id(), '_persoonsgegevens_email');
$combined_meta = trim( $meta_voornaam[0] . ' ' . $meta_achternaam[0] . ' ' . $meta_email[0]);
wp_update_post(
array (
'post_title' => $combined_meta,
)
);
endwhile;
endif;
wp_reset_query();
}
Hope it helps!