Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Can ajax search pro use relevanssi_do_query for live results?
- This topic has 13 replies, 2 voices, and was last updated 5 years, 3 months ago by
Ernest Marcinko.
-
AuthorPosts
-
March 4, 2021 at 10:53 pm #32016
pvanloon198341
ParticipantHi,
When searching with words like Musa, it shows a result in the live search box, but the word itself is not highlighted and also the excerpt text around the word is not showing. This is due to the word in the post is Mûsâ. My goal is to let the search also highlight Mûsâ in the text with the search phrase musa or Musa.
With the plugin relevanssi this is working on the results page. Musa does hightlight Mûsâ with excerpt around the word. But when I disable relevanssi than the default wordpress search does not doe this. It only shows the beginning of the post found.
It looks like Ajax search live pro makes use of the standard wordpress search functions regarding special characters.
So my question is:
Is it possible, with some code tweaks, to let the ajax search results use the relevanssi plugin. By using for example: relevanssi_do_query
I hope i’m clear enough and you can help me with this.
Kind regards,
Pascal
March 5, 2021 at 10:54 am #32025Ernest Marcinko
KeymasterHi Pascal,
It could be possible, but not via Relevanssi, but rather making a correction in the actual search code. If you want, I can try debugging this to check why the accented versions are not properly recognized, maybe I can come up with something. I will however need FTP access for that.
March 5, 2021 at 12:39 pm #32029pvanloon198341
ParticipantYou cannot access this content.
March 5, 2021 at 3:00 pm #32034Ernest Marcinko
KeymasterThank you Pascal!
Can you please also check the admin details? I tried to log-in to clerar the cache, but it says the password is probably incorrect. I may have found a possible solution but I can not test because of the cache.
March 5, 2021 at 3:22 pm #32036pvanloon198341
ParticipantYou cannot access this content.
March 5, 2021 at 3:29 pm #32038Ernest Marcinko
KeymasterThank you very much!
I have implemented the change, cleared the cache, it should work (better) now. I recommend clearing your browser cache, maybe the site cache again as well, and you should see an improvement.
March 5, 2021 at 3:42 pm #32040pvanloon198341
ParticipantYes! It’s works. Thank you so much Ernest.
There is only one issue left and that is regarding the word Qur’an which cannot be found by searching with phrase: Qur’an. This has to do with the ‘
Can you take a look at that also?
Thanks in advance. You give some great support 🙂
March 5, 2021 at 3:44 pm #32042pvanloon198341
ParticipantMaybe if you can tell me how you modified the code, I can do those changes myself in the future?
I also know html, css, javascript, php and mysql.March 5, 2021 at 3:44 pm #32043Ernest Marcinko
KeymasterYou are very welcome 🙂
It seems to be all right on my end with that keyword as well: https://i.imgur.com/cXsN0ZD.png
March 5, 2021 at 3:57 pm #32047pvanloon198341
ParticipantStill at my side it does not work. I think this has to do with the keyboard layout you use.
If you look carefully, you can see a small difference in the ‘ and the ’
The second one has a small curve…
When I type on my keyboard I get the straight one.
March 5, 2021 at 3:59 pm #32049pvanloon198341
ParticipantYou can try it with this example by copy pasting it:
qur’an
March 5, 2021 at 4:02 pm #32051Ernest Marcinko
KeymasterThat is probably it. Well, I belive the only thing I can suggest doing here is maybe using a custom code.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
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; }March 5, 2021 at 4:05 pm #32052pvanloon198341
ParticipantThank you Ernest. You gave one of the best support I’ve had with these kind of things.
Keep up the good work. Your plugin is one of the best search add-ons for wordpress!
March 5, 2021 at 4:06 pm #32053Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- You must be logged in to reply to this topic.