No, the pagination is already done in the plugin. The code example is from the README.
@gvocale: Is there actually something in your Algolia index? Before searching, you need to run the manual indexing method once (put algolia()->index(); somewhere and then remove it again). I will make that more clear in the plugin docs.
If I access my algolia dashboard, it says “Your index has no records…” and prompts me to upload a json / csv index, which confirms you theory of my index not being created.
In the “latest operations” it shows my queries, so I guess at least the website is communicating with Algolia.
That error message points out that you are using a read-only API key. Please use the “Write API Key” for the Kirby configuration variable as stated in the plugin documentation.
Thank you! I have changed the key in config.php with the one called “Admin API Key” from the Algolia Dashboard (I think they may have renamed it from Write API Key to Admin API Key).
The error on my page now disappeared, but when I search something, no results gets returned. When I check Algolia Dashboard, it still says that my index has no records in it.
About the manual indexing, I have added <?php algolia()->index(); ?> in my footer.php, opened the website (from localhost) and browsed a couple of pages.
Is there some other action I should do to let the website create and upload the index?
That’s interesting…
The Admin API Key should work fine too, but it generally makes sense to use a key with only the permissions you need as the admin key has way more permissions.
Could you please contact the Algolia support about this? It would interest me as well why you don’t have a write key.
You should not just add it there and browser a couple of pages. Each call to algolia()->index() uses as many Algolia “operations” as you have indexable pages. You have a limited amount of these per month.
So you should call this method only once and then remove it from your footer. From that point, the Panel hooks will index the updated pages automatically when you change the content.
Have you configured the plugin completely? Please see the plugin README for the required steps and follow them carefully. Especially the algolia.templates option seems to be missing.
@texnixe The pagination error is now fixed. It was a simple bug with the default value if the results are invalid because of a wrong API key.
Shouldn’t change anything with the current issue however.
That’s always possible, but as the Write API Key exactly matched the permissions we need for the plugin, it would be great to know why it is not there here. If that key has been removed for new accounts or something, we need to change the plugin docs.
I am trying to setting up Algolia in a site with 9000 pages. When I run the manual index it returns me the following error
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36864 bytes) in /Users/site/kirby/core/content.php on line 34
Is there something I can do?
I am using the following code to index:
<?php ini_set('max_execution_time', 0); //300 seconds = 5 minutes set_time_limit(0); //If set to zero, no time limit is imposed. algolia()->index() ; ?>
The issue behind the memory issue is that the plugin currently loads every indexable page into memory and sends all data together. I have added a feature request for the plugin to change this. We might consider this if other users have the same problem.