Open Sogl opened 1 year ago
I use MarkupFixer from the TOC plugin as a temporary solution:
$content = trim($page->content());
//for TOC search
$markup_fixer = new MarkupFixer();
$content = $markup_fixer->fix($content, $this->getAnchorOptions($page));
Working steps:
Anchors in search are now in place!
But now the process of rebuilding indexes eats a lot more memory and time, especially Reset Index.
This is quite strange.
If you have PageTOC enabled, it should default to add anchors, which in turn should be picked up by AgoliaPro.
Yes, it has nothing to do with Xdebug and version of Algolia plugin (I compared the files).
But my PageTOC plugin is always enabled. Any ideas? I can send configuration files etc if needed.
I use my own class (based on GravPageSearch
) to collect Flex Pages and Pages into one index. Last version is here: https://gist.github.com/Sogl/78dce78b254b39a6678f759b3ff981b7#file-gravflexpagesearch-php
Just sounds like an opcode cache issue to me.. nothing i would be able to replicate
This has nothing to do with the version of php, does it?
What is the right way to clear the opcode cache in this case?
usually restarting php process (php-fpm) clears it.
Just updated Algolia Pro plugin from 1.0.8 to 1.0.12 and now anchor navigation (targets) is missing when reindexing. I did not change the settings of the plugin. After removing the indexes on the production and localhost (they are different) and indexing a few times, I found that when I use Xdebug, the anchors are sent perfectly. Without debugging they simply aren't there...
Tried much combinations: delete index in Algolia, clear all cache, reindex in admin, flush index in admin, index in CLI. Found a workaround on the localhost: 1. Delete index in Algolia dashboard. 2. Index in Admin (still no anchors). 3. Index in CLI (anchors appear). But for some reason it does not work in production.
After further debugging, I found the problem in this piece of code (
GravPageSearch.php
line 402):When I click on Reindex Now in the Admin panel, the h2 tag does not contain an id, so the anchor is not passed. In CLI indexing the id appears, so it is added to the index.
But this solution does not work in production, anchors are not there.