Plugin Author
Ajay
(@ajay)
Hi Vanessa,
On 2, what is the solution you have implemented on the categories? And, are you deleting like 960 or 390?
On 1, you might need to edit the plugin code around line 358 to stop it for searching within the content.
// $sql .= "(MATCH(post_content) AGAINST ('%s' {$boolean_mode} ) * %d ) ";
$sql .= "AS score FROM ".$wpdb->posts." WHERE MATCH (post_title) AGAINST ('%s' {$boolean_mode} ) AND post_status = 'publish' ";
Alternatively, you might want to try setting the weighting of the content to 0 in the settings page.
Hi,
on 2, i changed this line
if ( $wp_query->is_search && $bsearch_settings['seamless'] && !is_admin() ) {
to
if ( $wp_query->is_search && $wp_query->is_main_query() && $bsearch_settings['seamless'] && !is_admin() ) {
And i deleted line 960 (not 390) Sorry.
on 1, i changed the weighting of the title to 10 and content 0. -> no changes.
I changed the code to
$sql .= "AS score FROM ".$wpdb->posts." WHERE MATCH (post_title) AGAINST ('%s' {$boolean_mode} ) AND post_status = 'publish' ";
and removed
$sql .= "(MATCH(post_content) AGAINST ('%s' {$boolean_mode} ) * %d ) ";
this line and it changes nothing.
Thanks for your answer.
Vanessa
Plugin Author
Ajay
(@ajay)
On 2, you mentioned “searches in all categorys again”. What do you mean by this?
On 1, are you in a position to install Query Monitor plugin and seeing what query is being generated on the search results page?
On 1, i installed the plugin and changed the code (removed the post_content sections in the query) and it works perfekt now. Thank you.
On 2. I want to search only portfolio items but when i delete line 960 i get results from portfolio and pages.
Plugin Author
Ajay
(@ajay)
If the portfolio is a different custom post type, you might want to add another WHERE clause for the portfolio post type.
WHERE post_type = 'portfolio'
Better Search needs a massive query rewrite that I’ve done for my Top 10 and Contextual Related Posts plugins that allow cleaner query overwrites than what you currently have. It’s on the charts. Although, not with a definite timeline to implement
Plugin Author
Ajay
(@ajay)
Hi,
I’ve released v2.0.0 which fixes the Better Search bug on the query being overwritten incorrectly.