Search by Algolia Wordpress Plugin Error

I have just installed this plugin and try to indexing my posts, pages and users. But it returns an error. I have ttried inside another wordpress project which has 3-4 posts and pages, then it is working fine in that. So may be when there is 500+ posts then it occurs issues. Why?

Hi there,

Could you share with us the logs like explained on this page?

Looking forward to help you out!

I have followed the steps given there and “debug.log” file is generated, it is as follows.

[07-Apr-2017 09:12:24 UTC] PHP Notice: Trying to get property of non-object in D:\xampp\htdocs\imeg.wpengine.com\wp-includes\post.php on line 5671

[07-Apr-2017 09:12:24 UTC] PHP Notice: Trying to get property of non-object in D:\xampp\htdocs\imeg.wpengine.com\wp-includes\post.php on line 5751

[07-Apr-2017 09:12:24 UTC] PHP Catchable fatal error: Argument 1 passed to Algolia_Task::__construct() must be an instance of WP_Post, null given, called in D:\xampp\htdocs\imeg.wpengine.com\wp-content\plugins\search-by-algolia-instant-relevant-results\includes\class-algolia-task.php on line 74 and defined in D:\xampp\htdocs\imeg.wpengine.com\wp-content\plugins\search-by-algolia-instant-relevant-results\includes\class-algolia-task.php on line 93

Hi,

Same problems here. After entering a keyword and pressing Enter, it takes me to the search results page which displays broken and shows these PHP Notices: https://www.dropbox.com/s/sjdugubkm9ld93d/Schermafdruk%202017-05-10%2013.53.02.png?dl=0

[10-May-2017 11:26:08 UTC] PHP Notice: Trying to get property of non-object in /home/xx/public_html/xx.com/wp-includes/class-wp-query.php on line 3428
[10-May-2017 11:26:08 UTC] PHP Notice: Trying to get property of non-object in /home/xx/public_html/xx.com/wp-includes/general-template.php on line 1125
[10-May-2017 11:26:08 UTC] PHP Notice: Trying to get property of non-object in /home/xx/public_html/xx.com/wp-includes/general-template.php on line 1295
[10-May-2017 11:26:08 UTC] PHP Notice: Trying to get property of non-object in /home/xx/public_html/xx.com/wp-includes/general-template.php on line 1153
[10-May-2017 11:26:08 UTC] PHP Notice: Trying to get property of non-object in /home/xx/public_html/xx.com/wp-includes/class-wp-query.php on line 3428
[10-May-2017 11:26:08 UTC] PHP Notice: Trying to get property of non-object in /home/xx/public_html/xx.com/wp-includes/general-template.php on line 2681
[10-May-2017 11:26:08 UTC] PHP Notice: Trying to get property of non-object in /home/xx/public_html/xx.com/wp-includes/general-template.php on line 2682

I only got these notices after installing the Algolia WordPress plugin. I’m using the plugin for my WooCommerce setup. Any idea how to resolve these?

EDIT: I’m using the latest WooCommerce and WordPress versions.

1 Like

Working on it today, and I’ll hopefully be able to give you quick feedback.

Thank you kindly, Ray!

1 Like

I think that get_post_type_object in WordPress behaves differently since 4.6 and doesn’t handle ‘any’ post type anymore.

I will try to implement a workaround.

I’m not a developer myself so I can’t assist here, unfortunately. But thanks so much for replying swiftly!

1 Like

I fixed the issue in version 2.0.1 of the WordPress plugin which has just been pushed to the WordPress plugin repository.

Let me know how that works out for you.

Cheers,

Thanks so much! That fixed it. However, the search results container is displayed fully to the left: https://www.dropbox.com/s/iq1o5eiq0viruo2/Schermafdruk%202017-05-10%2016.33.45.png?dl=0

Any idea how to resolve this? Thanks so much!

That wasn’t the case before?

Could you send me a link to a live website so that I can check it out? Feel free to send it over DM :wink:

No, it wasn’t. I have sent you a DM. Cheers!

I saw the issue.
We actually removed the max-with CSS rule some time ago and I suppose you were using a version still having that one.

As a workaround, you could add the following to your styles.css file of your active theme:

.ais-wrapper {
    max-width: 1200px;
    margin: auto;
}

I tried it out on your theme and it should do the trick.

Let me know how that goes.

I have just tried that, even with !important but no luck. Any ideas?

1 Like

I made an error while typing the answer, here is the correct code:

#ais-wrapper {
    max-width: 1200px;
    margin: auto;
}

Does that work better?

That fixed it! Thanks! Did you read the last part of my DM? Still struggling a bit with that part.

I can see the other issue indeed.
The problem is that the autocomplete dropdown is positioned absolutely based on the location of the search input and then displayed.

Afterwards it is only repositioned every time it needs a refresh.

Your theme seems to offer a fixed search input that stays on top of everything even when the user scrolls.

For now the only solution I have to offer is to disable the fixed header if possible in your theme.

Thanks Ray, I have contacted the authors of the premium theme to see what they have to say. Cheers!

1 Like