Search based on the full string
-
Hi,
Im using relevanssi instead of the regular wordpress search
I had 2 queries1st I wanted to search the tilte and contents for the full string searched
for eg i search for “is this true” then wordpress query searches for search_terms : is, this and true. I dont want this meaning it should search tile, content etc for search term “is this true”. So I did as follows:
$wp_query->query_vars[‘search_terms’] = array( “0” => ‘”‘.$_REQUEST[‘s’].'”‘);
$wp_query->query_vars[‘s’] = ‘”‘.$_REQUEST[‘s’].'”‘;
$wp_query->query[‘s’] = ‘”‘.$_REQUEST[‘s’].'”‘;
relevanssi_do_query($wp_query);when i display the output it shows me the search_term as array(“0″=>”is this true”)
But when i echo the content with highlighting using following code
if (function_exists(‘relevanssi_highlight_terms’)) {
echo relevanssi_highlight_terms(get_the_content(),get_search_query());
}
else { echo get_the_content(); }it shows me individual search term highlighted like “is this”, “this”, “is”, “this true” etc
I dont want this to happen ANY SOLUTIONS 🙁
As a record with title “is this true” has to come top even if the number of matched string in content is more. Hope u got what i mean2nd how to project the relevance score as a percentage.
Plz help
Aalok Dhond
The topic ‘Search based on the full string’ is closed to new replies.