• Resolved atutrabajo

    (@atutrabajo)


    Hello. I have the following problem with your plugin/service:
    1) Before choosing to “install” them, I had the following page of results (*) Obviously in order to show you, I’m going to temporarily disable your plugin…
    https://ibb.co/Ny6ykVy

    If they realize, it’s not a big deal but hey. When they see what you offer me. Anyway.
    2) As the results page that you see in the previous screenshot (which is the “original” of my template – Hello Elementor – what are you going to do :)… it was a bit “bland”, I decided for looking for alternatives and, I ended up “recalling” with you. But…
    It turns out that the “alternative” that you “offer” me is WORSE. But better, so that you understand what I want to explain to you, here is another screenshot, with the “result” of the same previous search (resume) but, with your plugin active and – supposedly – with instantsearch activated (*) Further down I explain the “supposedly”.
    Okay. There you go…
    https://ibb.co/hKYW043

    As you can see, the NOTHING itself (at least in the “original” had RESULTS), instead of the one you use as a “replacement” there is NOTHING!!!
    3) Now. As I mentioned earlier, this is the “result” when enabled in the option, instansearch. Which, supposedly, should…
    …”add a search-as-you-type dropdown menu to your search bar(s)”…
    According to what you yourselves “promise”.
    However. Perhaps you will wonder and rightly so, because, to get to those “results”, clearly what I did is write in the search or resume and (before the results appear) hit enter.
    Simple.
    Because this is how visitors to different sites usually (usually) act.
    That is, if the “options” take too long to appear, we assume that, to find results, we have to click or enter. Spot.

    In the meantime, and to find "alternatives", I tried the option...
    ..."Use Algolia in the backend"...
    And, with this option activated, the "result" for the same search as the previous ones (resume), was the following...
    https://ibb.co/CWg5zM3
    
    As you can see, in the title of the result, it includes that "horrible" thing of...
    <em class="algolia-search-highlight">Curriculum</em>
    And to top it all off, instead of using the excerpt I carefully prepared on each page and/or post, a snippet of the article/page appears which is obviously NOT exactly what I'd like it to appear (That's why I prepared an excerpt on each page or entrance, heh).
    And so?
    So, the "problem" is the following...
    When you write a query, in the search engine... NO IMMEDIATE options appear! (Neither with instantsearch nor - much less - with "Algolia in the backend").
    Ergo. What will happen is that visitors write the word and hit enter as soon as they finish writing it.
    And guess what. Exact...
    - If I have the instantsearch option installed, they will go to the EMPTY results page that I showed them in the 1st. screenshot.
    - On the other hand, if I have "Algolia in the backend" set, the result will be the one in the last screenshot (*)
    (*) I mean, with that "horrible" thing in the title.
    Now to finish...
    The solution then is - or should be - that, the options appear..."as you type into your search bar(s)"... (As you "promise").
    In case, for whatever reason, that is not achieved, I would have to leave "Algolia in the backend" (what I have now).
    Why? Simple. Because - as I already mentioned - instantsearch is NOT so "instant" Ergo, the visitor, is very likely to click BEFORE the dropdown appears, and - thus - they will end up in NOTHING itself!
    Obviously, the ideal would be for the results to appear as you type peeero (if you can't), at least - with this option - they will end up on a page (FEA) where, at least, they will see some result (UGLY. But - even - something is something)
    
    I await your comments.
    
    From already thank you very much.
    
    Greetings.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Are you purposely disabling and/or avoiding jQuery by chance? I am seeing an error for that in my browser developer console, and the templates used for instantsearch do make use of jQuery.

    Thread Starter atutrabajo

    (@atutrabajo)

    Hello Michael. First of all, thanks for replying.

    With that being said, and with regards to…
    …”Are you disabling and/or avoiding jQuery on purpose by any chance?”…
    The answer is, I don’t know, ha!

    I explain:

    In my eagerness to try to improve my WPO, I searched (and am still searching, heh) for information about it and (regarding JQuery), I found articles like this one; https://dotlayer.com/what-is-migrate-js-why-and-how-to-remove-jquery-migrate-from-wordpress/
    
    Which, as you can see, does NOT talk specifically about JQuery but about JQuery Migrate and, among other things, it says that...
    ..."is a javascript library that allows you to preserve the compatibility of your jQuery code developed for versions of jQuery prior to 1.9"...
    
    Me what...
    ..."restore deprecated features and behavior so that old code still runs correctly in the current version of jQuery and later"...
    
    Me what...
    ..."If you're running plugins that use older jQuery code, it's probably best to update them or switch to an alternative that stays up to date"...
    
    And - as well - they mentioned that...
    ..."jQuery migrate adds unnecessary load to your site"...
    I decided to remove it, using the following code in my function.php

    //Remove JQuery migrate

    function remove_jquery_migrate( $scripts ) {
       if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
            $script = $scripts->registered['jquery'];
       if ( $script->deps ) { 
    // Check whether the script has any dependencies
    
            $script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
     }
     }
     }
    add_action( 'wp_default_scripts', 'remove_jquery_migrate' );
    

    However…
    When I remove this code from my function.php, 2(two) things happen (both “bad”, heh).
    1) The 1st. your instantsearch function is still NOT working!
    Namely. Load results load. But NOT instantly. But after a while of turning the “thing” that I don’t know what it’s called, heh.
    And this – as you surely know – can be “deadly” because, it is very likely that the visitor ends up hitting the Enter key and (again) we would go on to the “problems” mentioned at the beginning.
    2) In my Chrome Inspector, I get the following error…
    JQMIGRATE: Migrate is installed, version 3.3.2

    In fact, I did the following tests (before making the decision that I comment below):
    a) I disabled Cloudflare + W3TC (ie the tools that control my cache), so that the test is "fair".
    b) This is an extract from the "critical request chain" (According to Pagespeed);
    https://ibb.co/ZY5dP9C
    You will notice that, they appear almost together and simultaneously, these 2...
    ...jquery/jquery.min.js(stage9.yourwork.org) - 180 ms, 32.56 KB
    …jquery/jquery-migrate.min.js(stage9.yourwork.org) - 130 ms, 5.17 KiB
    That is to say that... jquery appears (which adds 180 ms) + jquery migrate which... Adds another 130 ms!
    
    Now, I'm going to insert the aforementioned code back into my function.php to remove jquery migrate (And see what happens).
    
    And (as the "Chapulín Colorado" used to say, heh:)...
    ..."As I suspected from the beginning"...
    I do NOT get ANY JQuery errors.
    Definitely. I am going to leave the code in my function.php because, as I said, I do NOT see significant improvements in the speed of loading the results in the search engine.
    But yes, I see one less error (the one I mentioned in point 2) and, furthermore, as I mentioned at the beginning of this text...
    ..."One less JS file is always - even - a few milliseconds less in load"... (Something very important for the WPO).
    In fact, with jquery migrate installed, this was the result...
    https://ibb.co/hLmhGzv
    Instead, without jquery migrate, the result was the following...
    Here the one corresponding to the "chain of critical requests"...
    https://ibb.co/PFDCzNM
    Where you can see that jquery.min is, with its "damn" 150 ms
    And as for the score, the result was as follows...
    https://ibb.co/dmpcLJL
    Yes. I know. It's not a big deal". But you well know that a JS file is a JS file.
    And - anyway - evidently that code was NOT "responsible" for removing jquery.
    Which, by the way, according to Pagespeed... is loading!
    Ergo. I don't know why it gives you "error".
    And, in any case, it does NOT influence (too much) the speed at which the results are presented in the search engine.

    `Conclusion:
    – I leave the code in the function.php to remove jquery migrate
    – jquery KEEP LOADING
    – In Algolia I leave the option “Use Algolia in the backend” checked
    And I await your comments to see if, with all this background, you find a solution, heh.
    From already thank you very much.
    Greetings.
    P.s: If you still believe that the code I mention having installed in the function.php is “responsible” for something, could you send me a version that says (for example) that…
    …”disable jquery migrate unless you have (whatever) installed”…
    Or, following what I could see in the articles that I told you about…
    …”turn off jquery migrate as long as I have jquery versions higher than (whatever)”…
    Or something like that.
    Or – directly – Couldn’t you include something in the plugin code so that these problems disappear?
    I ask you because, here between us, I have seen these search engines work on other sites and they do it quite well.
    For example, there is a porn site (xvideos.com) that – of course – the friend, a friend’s, a cousin’s, a work colleague’s told me, heh.
    But I’m telling you so you can see how I would like it to work (NOT with those results, obviously, heh:)
    Because, if not, sooner rather than later, unfortunately I will have to opt for the results that I had originally because, badly or badly, they look better than the ones I am seeing with Algolia installed.
    Pd2: Now yes, I’m going to leave everything as it was and, of course, that includes Cloudflare + W3TC activated because, after all, that’s how it should work.
    I’m telling you so you can see if, with the cache + minimized installed, I would have to improve/change something in my settings.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Let’s have you add this to your active theme’s functions.php and once that’s done, I can re-check and see if the jQuery issue has resolved itself, and if yes, we can move forward from there.

    function wds_algolia_load_jquery() {
    	wp_enqueue_script('jquery');
    }
    add_action('wp_enqueue_scripts', 'wds_algolia_load_jquery');
    
    Thread Starter atutrabajo

    (@atutrabajo)

    I am sorry. It does not let me.

    When I try to enter this you passed me…

    función wds_algolia_load_jquery() {
    wp_enqueue_script(‘jquery ‘);
    }
    add_action(‘wp_enqueue_sc ripts ‘, ‘wds_algolia_load_jquery& #039;);

    WordPress tells me that…
    Changes to your PHP code have been reverted due to an error on line 236 of the wp-content/themes/hello-theme-child-master/functions.php file.

    Please fix it and try to save again.

    And add the following…
    syntax error, unexpected identifier “wds_algolia_load_jquery”

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Best answer I have for that is maybe when copy/pasting, the quote characters got changed and needs re-typed.

    Or perhaps try copy pasting the version at https://gist.githubusercontent.com/tw2113/f0f8cc6349e4962c66d428d817c16dde/raw/28faaeee789140b1d8382f8d5e38e57a389caf2d/jquery.php

    Thread Starter atutrabajo

    (@atutrabajo)

    oh Yes now. It already seemed to me that those symbols at the end could not be part of the code, heh!

    Okay. Do not talk more…

    1) I already installed your code in my function.php

    2) I already returned Algolia to the option Use Algolia with Instantsearch.js

    3) I already cleared all caches.

    And now?

    Because frankly, I don't see ANY change.
    
    I don't know. Now I leave it to you as my site should work.
    
    If you want, try looking for something yourself and tell me.
    
    You think?
    
    I await your comments.
    
    Greetings.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Do you have any plugins or whatnot that’s forcing javascript files to the end of the page instead of potentially at the start?

    I’m definitely seeing jQuery loaded now, but still seeing the same error, which as me thinking the jQuery script tags in our instantsearch template file is trying to run before jQuery itself is loaded.

    Thread Starter atutrabajo

    (@atutrabajo)

    No. For the same reason that I told you at the beginning (Optimize my site, without the need for so many plugins and others), I used a code that makes ALL the JS load in the footer to – that way – “comply” with what to remove the code that blocks rendering.
    The code in question is this…

    // Remove JS enqueued in the header and move it to the footer

    add_action( 'wp_enqueue_scripts', function () {
    remove_action('wp_head', 'wp_print_scripts');
    remove_action('wp_head', 'wp_print_head_scripts', 9);
    remove_action('wp_head', 'wp_enqueue_scripts', 1);
    add_action('wp_footer', 'wp_print_scripts', 5);
    add_action('wp_footer', 'wp_enqueue_scripts', 5);
    add_action('wp_footer', 'wp_print_head_scripts', 5);
    });
    But hey. I already take it off. But unless you show me it was worth it, I'm going to install it again in a while.
    
    I await your comments.
    
    Greetings.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    For the sake of trial/error/confirmation, can you undo your script moving so that we can see if the InstantSearch works without that in place?

    InstantSearch is using jQuery to instantiate everything.

    For example, these lines are where our jQuery starts:
    https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/templates/instantsearch.php#L73-L74

    and then they end at https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/templates/instantsearch.php#L200-L201

    Everything between is just standard Javascript that’s making use of Algolia Instantsearch.

    So we need to either amend the template to in some way run AFTER your moving of jQuery’s load position, or remove jQuery itself from the template.

    Thread Starter atutrabajo

    (@atutrabajo)

    Yes. I didn’t understand you at all. Sorry, heh.

    But I confirm that, I ALREADY removed that code that sent ALL the .js to the footer.

    Ergo. Now ALL JS (including Algolia’s) are in their “original” places.

    So now, it’s all yours.

    But remember that I also left the previous code you sent me installed.

    I await your comments.

    Greetings.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hmm, now it looks like it’s throwing similar/matching errors with the Autocomplete output, and I’m not completely sure that InstantSearch is still being loaded at all. The view source is all minified now, making it a bit harder to parse.

    Basically at this moment, I want to see how things are with:

    1. Autocomplete disabled
    2. InstantSearch enabled
    3. Javascript not forced to load in the footer.
    4. The view source not being minified at all.

    Overall, it’s feeling most like jQuery conflicts and making everything work together still with load order customized.

    Thread Starter atutrabajo

    (@atutrabajo)

    Okay. You want is you have it…

    1) Autocomplete disabled

    2) Instant search enabled

    3) ALL JS files are loaded in their original places (Including Algolia’s)

    4) Since I don’t know what generates what you say about…”The view source is not minimized at all”…
    I simply excluded from the minimized ALL Algolia files, heh.

    That is:

    a) The ONLY CSS file I found. Namely...
    /wp-content/plugins/wp-search-with-algolia/css/algolia-autocomplete.css?ver=2.2.0
    
    b) ALL JS files. Namely...
    /wp-content/plugins/wp-search-with-algolia/js/algoliasearch/dist/algoliasearch-lite.umd.js?ver=2.2.0
    /wp-content/plugins/wp-search-with-algolia/js/algoliasearch/dist/algoliasearch-lite.umd.js?ver=2.2.0
    /wp-content/plugins/wp-search-with-algolia/js/autocomplete.js/dist/autocomplete.min.js?ver=2.2.0
    Finally...
    
    c) In my cPanel/Metrics/Errors I get these error messages...
    
    [2022-07-26 01:57:15]: uid: (1926/atutra19) gid: (1924/atutra19) cmd: suspendedpage.cgi
    [2022-07-15 17:31:32]: uid: (1926/atutra19) gid: (1924/atutra19) cmd: suspendedpage.cgi
    [2022-07-15 17:30:50]: uid: (1926/atutra19) gid: (1924/atutra19) cmd: suspendedpage.cgi
    [2022-07-15 17:30:21]: uid: (1926/atutra19) gid: (1924/atutra19) cmd: suspendedpage.cgi
    [2022-07-15 17:28:49]: uid: (1926/atutra19) gid: (1924/atutra19) cmd: suspendedpage.cgi
    [2022-07-15 17:08:55]: uid: (1926/atutra19) gid: (1924/atutra19) cmd: suspendedpage.cgi
    Does it have something to do with you?
    
    I await your comments.
    
    Greetings.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Would you be willing to take parts of this to private correspondence, regarding elevated access? I feel like it may be easier and more time efficient to try some things directly instead of trying to go back and forth with this.

    If yes, could you reach out at https://pluginize.com/contact/ and reference this thread.

    Thread Starter atutrabajo

    (@atutrabajo)

    Clever. It is done. For now is it all? Because, if so, I’m going to sleep, heh:) Tomorrow is another day. See you! PS: Everything is as I told you before. That is:
    1) With the code you sent me in my function.php
    2) With what you asked me in the last mail regarding Autocomplete, Instant Search, Javascript and, with ALL Algolia files EXCLUDED from the minimized one.
    3) With W3TC + Cloudflare Enabled and all caches cleared.

    I hope this helps.

    Greetings.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Issues boiled down to details around jQuery loading and caching/performance optimizations.

    We have https://github.com/WebDevStudios/wp-search-with-algolia/issues/227 opened to help confirm things going forward to help with compatibility around script loading placement/orders

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Design flaws’ is closed to new replies.