• Resolved micahjsharp

    (@micahjsharp)


    Hello, I recently updated WP Search With Algolia from 2.3.1 to 2.5.0 using composer as I’ve always done. Testing it on my staging server however caused a critical error related to Class ‘Algolia\AlgoliaSearch\SearchClient’ not being found. The code that threw the error in my template search file is as such:

    $client = Algolia\AlgoliaSearch\SearchClient::create(
    $this->application_id,
    $this->api_key
    );

    This was the error. Any ideas? Downgrading back to 2.3.1 causes the problem to go away.

    Fatal error: Uncaught Error: Class ‘Algolia\AlgoliaSearch\SearchClient’ not found in /var/app/httpdocs/bedrock/web/app/themes/toolfarm/template-search.php:103

    An interesting tidbit is that I did also see a warning at the top of the WordPress plugins page that stated “Custom WP Search With Algolia template files autocomplete and instantsearch.php are out of date at 2.0” after updating to 2.5.0. I don’t believe we directly edit those files so not sure how they are get updated.

    Thank you in advance.

    Micah

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

    (@tw2113)

    The BenchPresser

    Hard to say with all of this, since you shouldn’t be needing to run any composer commands if you’re using the plugin, we ship with all the composer libraries and vendor folders. That said, I also know we had this line item change in version 2.4.0

    • Prefixed Algolia library to avoid potential conflicts with other code using the same libraries.

    Where we now have our vendor folder named vendor_prefixed to avoid potential other code clashes. If your for sure intending on relying on our plugin for the search client library, you’ll likely need to update namespace prefixes, for example WebDevStudios\WPSWA\Algolia\AlgoliaSearch\SearchClient

    That said, it feels like you’re also doing things custom in regards to templates, which we definitely understand and get, but that also makes it a little difficult to troubleshoot those parts. We’d do what we can, but hard to say without seeing code.

    Regarding the admin notice, if you have a folder named algolia and the out of box autocomplete.php and instantsearch.php files in there, that’s why you’re seeing that notice, even if you’re not using them.

    You can see the changes made for version 2.5.0 at this link:

    https://github.com/WebDevStudios/wp-search-with-algolia/pull/310/files#diff-bd07eb479cca898bf5465bfd70977fa2c7663f2248faa358e0344288394a1b4c

    Thread Starter micahjsharp

    (@micahjsharp)

    Thank you @tw2113 I’ll try updating the namespace with the new prefix and see if that solves the problem. Appreciate the help.

    Regarding the two files (located in /plugins/wp-search-with-algolia/templates), if composer doesn’t update those to 2.5, shall I do that manually? Thank you.

    • This reply was modified 1 year, 11 months ago by micahjsharp.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Also a potential lesson for us that we need to communicate these things a bit more, but it’s also really hard to gauge exactly how custom people have gone with the plugin. ??

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Regarding the two files (located in /plugins/wp-search-with-algolia/templates), if composer doesn’t update those to 2.5, shall I do that manually? Thank you.

    Not sure why you need to be touching these directly, since they should have updated automatically with the update to the plugin code when you pulled in the 2.5.0 changes. It’s any copies in the theme that would be not touched at all.

    Thread Starter micahjsharp

    (@micahjsharp)

    Updating my code to use the namespace fixed the problem.

    $client = WebDevStudios\WPSWA\Algolia\AlgoliaSearch\SearchClient::create(
    $this->application_id,
    $this->api_key
    );

    Thanks again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error on upgrade to 2.5.0 from 2.3.1’ is closed to new replies.