Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Not all keywords shows as results › Reply To: Not all keywords shows as results
Thank you! I looked up the configuration, and made a few changes, hopefully in your favor. The problem here I believe is, that the word “U-värde” was not recognized by either of the PDF parsers, and probably some other unwanted strings or boundaries were indexed. While the search tries to resolve these as much as possible, it looks like that some content is still not properly indexed.
There are a few things we can do about it to make it better. First, I applied the following logic configuration, and limit configuration.
I also added this custom code to the functions.php file in your child theme directory.
add_filter('asp_search_phrase_before_cleaning', 'asp_replace_characters', 10, 1);
add_filter('asp_query_args', 'asp_replace_characters', 10, 1);
function asp_replace_characters( $s ) {
$characters = "',._-?!"; // Type characters one after another
$replace_with = ' '; // Replace them with this (space by default)
if ( is_array($s) ) {
if ( isset($s['s']) && !$s['_ajax_search'] )
$s['s'] = str_replace(str_split($characters), $replace_with, $s['s']);
} else {
$s = str_replace(str_split($characters), $replace_with, $s);
}
return $s;
}
This code will remove “-” and other special characters from the search phrase. This way, when entering “U-värde” the plugin will search “U värde”. With the “AND” logic, it will look for partial matches for both “U” and “värde” keywords – which are apparently present in the index for those files.
I had to increase the limit as well, because other results also appeared for this new search logic, and so more of them are displayed – otherwise they might appear as “missing”.