Search Result Issue
-
When you type in the phrase “frez cb033”, a lot of search results are displayed that only match the phrase “frez”.
But the product “MANI KING Frez ceramiczny CB033 – walec, XF” (that is, the only one that matches both words) is displayed only on the third page.
Is it possible to solve this problem so that the matching product (the only one) displays at the top of the search results?
(Site in Polish)
I used the code below and did a reindex, but it did not help:
add_filter( 'aws_indexed_data', 'my_aws_indexed_data', 10, 2 ); function my_aws_indexed_data( $data, $id ) { $data['terms']['full_title'][get_the_title( $id )] = 1; return $data; } add_filter( 'aws_search_query_array', 'my_aws_search_query_array' ); function my_aws_search_query_array( $query ) { $relevance = ''; $term = esc_attr( $_REQUEST['keyword'] ); $term = htmlspecialchars_decode( $term ); $term = AWS_Helpers::normalize_string( $term ); if ( $term ) { $relevance .= "( case when ( term_source = 'full_title' AND term LIKE '%{$term}%' ) then 800 else 0 end ) + "; $query['relevance'] = preg_replace( '/\(SUM\([\s\S]*?\([\s\S]*?case[\s\S]*?end[\s\S]*?\)[\s\S]*?\+/i', '$0' . $relevance, $query['relevance'] ); } return $query; }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Search Result Issue’ is closed to new replies.