• The fatal error is produced on class-algolia-admin-page-native-search.php:242, when the index does not exist. Please add a check that the index exists:

    $searchable_posts_index = $this->plugin->get_index( 'searchable_posts' );
    if ( empty( $searchable_posts_index ) ) {
    // The index was not set up.
    return;
    }

    • This topic was modified 1 day, 10 hours ago by Iulia Cazan.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @iulia-cazan

    Definitely willing to help harden this spot up where able. I’m curious if you’re managing to load the “Search Settings” options page at all, or if it’s error-ing immediately.

    Also is this a brand new install that you’re seeing this with? or have you been a user of the plugin for a little bit already?

    Based on the code spot in question, and the boundaries to reach that line, it seems that the index failed to be created. Line 235 shows an early return if not using Algolia for either native search or Instantsearch.

    https://github.com/WebDevStudios/wp-search-with-algolia/blob/ef6acc779eee665b522b92b6f3312310f3b81268/includes/admin/class-algolia-admin-page-native-search.php#L235-L249

    Thread Starter Iulia Cazan

    (@iulia-cazan)

    Hi @tw2113,

    Thanks for the quick reply!

    I can replicate the issue in a project that had the plugin up and running for some time now, after updating the package to the recent versions.

    It appears that the index for searchable_posts does not exist in Algolia, as it was not used previously or there was some issue in the migration.

    The fatal error happens on all admin pages, because of the display_errors method is not checking that the index exists. I cannot reach any of the pages to at least update the plugin settings at this point, so that the index to be created again if needed.

    Let me know if this gives enough context.

    Thanks!
    Iulia

    • This reply was modified 1 day, 7 hours ago by Iulia Cazan.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’m thinking that it doesn’t really have anything to do with the 2.11.0 release that we did yesterday, as the file location in question wasn’t touched with the release.

    You mention migration, so I’m wondering if that also involved changing Algolia prefixes and/or applications as a whole between the two.

    Site A had either Native search or InstantSearch toggled and the index created for Application A

    Site B had the database imported in from Site A, and switched to Application B.

    Site B has the Native search or InstantSearch option listed in its saved options, but the index creation wasn’t run for Application B yet.

    Does that sound accurate for the site you’re working with?

    The index creation happens as part of the save process for the page.

    Definitely a bit of an edge case, but one we’re happy to touch up.

    That snippet from you earlier, should help get you re-set up, while we work on getting this patched up officially. Even if just momentarily so you can get the pages loading and save settings to trigger the index creation.

    $searchable_posts_index = $this->plugin->get_index( 'searchable_posts' );
    if ( empty( $searchable_posts_index ) ) {
    return;
    }

    At https://github.com/WebDevStudios/wp-search-with-algolia/blob/ef6acc779eee665b522b92b6f3312310f3b81268/includes/admin/class-algolia-admin-page-native-search.php#L241-L242

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Thread Starter Iulia Cazan

    (@iulia-cazan)

    Hi @tw2113,

    The migration happened in a multisite installation, so many things could have gone wrong, from settings to Algolia API indices.

    Definitely, adding the check if the index exists in the plugin and pushing the code like that allowed me to access the settings page and create the index. I was hoping you could add the check in your next release, so that this is as robust as possible and could solve similar issues for other projects as well, and also have that in the project the next time we upgrade.

    Thanks for your support and great plugin!
    Iulia

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’ve added https://github.com/WebDevStudios/wp-search-with-algolia/commit/ffc6fa767b5dc005361ec351033c90ad053988da via our opened issue at https://github.com/WebDevStudios/wp-search-with-algolia/issues/530

    Working out when we want to push the release out at this point, but it’s planned to be in a 2.11.1 release

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.