Can ajax search pro use relevanssi_do_query for live results?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Can ajax search pro use relevanssi_do_query for live results?

This topic contains 13 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 years ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #32016
    pvanloon198341
    pvanloon198341
    Participant

    Hi,

    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

    #32025
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #32029
    pvanloon198341
    pvanloon198341
    Participant
    You cannot access this content.
    #32034
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #32036
    pvanloon198341
    pvanloon198341
    Participant
    You cannot access this content.
    #32038
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #32040
    pvanloon198341
    pvanloon198341
    Participant

    Yes! 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 🙂

    #32042
    pvanloon198341
    pvanloon198341
    Participant

    Maybe 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.

    #32043
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    You are very welcome 🙂

    It seems to be all right on my end with that keyword as well: https://i.imgur.com/cXsN0ZD.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #32047
    pvanloon198341
    pvanloon198341
    Participant

    Still 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.

    #32049
    pvanloon198341
    pvanloon198341
    Participant

    You can try it with this example by copy pasting it:

    qur’an

    #32051
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    That 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; 
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #32052
    pvanloon198341
    pvanloon198341
    Participant

    Thank 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!

    #32053
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.