Hi Paul
Minesh is on vacation so I'll handle this.
I looked through the previous thread, and set up a similar-but-slightly-different solution on my local test site which works as expected in a single language and with WPML, assuming that you are using the same View on the translations of the different pages.
Here is the code I added to my site:
function tssupp_search_exact_match( $view_args, $view_settings, $view_id ){
if ( 45 == $view_id ) {
if ( !isset( $view_args['s'] ) ) {
//no search term, bork the query
$view_args['post__in'] = '0';
}
// search term exists, so...
// 1. strip spaces to force a single search term
$search = preg_replace('/\s+/', '', $view_args['s'] );
$view_args['s'] = $search;
// 2. modify SQL WHERE clause to use LIKE 'search' not LIKE '%search%'
add_filter( 'posts_search', 'tssupp_modify_sql_where', 1000, 2 );
}
return $view_args;
}
add_filter( 'wpv_filter_query', 'tssupp_search_exact_match', 101, 3 );
function tssupp_modify_sql_where( $search, $wp_query ){
$search = preg_replace("/{(.*)}/U", "", $search);
return $search;
}
function tssupp_remove_modify_sql_where( $query, $view_settings, $view_id ){
if ( 45 == $view_id ) {
remove_filter( 'posts_search', 'tssupp_modify_sql_where', 1000, 2 );
}
return $query;
}
add_filter( 'wpv_filter_query_post_process', 'tssupp_remove_modify_sql_where', 10, 3 );
Note that the View ID needs editing in two places.
This code assumes that the post titles in question don't contain spaces (from your original post that seems to be the case); it doesn't matter if users include spaces in the search box, they will be stripped.
It is also case-insensitive.
Lastly, for the "error" message, this simply comes from the no-posts-found section of your View Loop Output, which can say something like "no matching results, please enter a 10 digit code".