-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[algolia-pro] CLI indexing. Crawl indexing get stuck at 0 and doesn't start indexing. #337
Comments
it sounds like the problem is that the indexing get's stuck at 0 and doesn't start indexing? The message from the progerss bar about being unable to display the estimated time is not the real issue? your issue title is confusing. |
Yes. I did some debugging and found that my Flex pages simply don't open during Crawl:
$page = $pages->find($route);
...
if ($page instanceof PageInterface) {
$this->addRecordFromResponse($page, $response, $url,$records, $status);
} else {
$status[] = [
'status' => 'error',
'msg' => 'Page Not Found: ' . $route,
'url' => $url
];
... I think it's because my routes are created dynamically in my Flex plugin: public function onPluginsInitialized(): void
{
if (!$this->isAdmin()) {
$this->router();
}
}
public function router()
{
/** @var Uri $uri */
$uri = $this->grav['uri'];
$route = Uri::getCurrentRoute()->getRoute();
if (Utils::startsWith($route, '/therapies') && !Utils::contains($route, '.')) {
$this->enable([
'onPagesInitialized' => ['addTherapyPage', 0]
]);
}
}
public function addTherapyPage()
{
$route = Uri::getCurrentRoute()->getRoute();
$normalized = trim($route, '/');
if (!$normalized) {
return;
}
$parts = explode('/', $normalized, 2);
$key = array_shift($parts);
$path = array_shift($parts);
/** @var Pages $pages */
$pages = $this->grav['pages'];
if ($pages->find($route)) {
/** @var Debugger $debugger */
$debugger = $this->grav['debugger'];
$debugger->addMessage("Page {$route} already exists, page cannot be added", 'error');
return;
}
$flex = Grav::instance()->get('flex');
$therapy = $flex->getObject($path, 'therapies');
$page = $pages->find('/therapies/therapy');
if ($page) {
$page->id($page->modified() . md5($route));
$page->slug(basename($route));
$page->folder(basename($route));
$page->route($route);
$page->rawRoute($route);
$page->modifyHeader('object', $path);
if ($therapy) {
$title = $therapy->getProperty('title');
$page->title($title);
$page->media($therapy->getMedia());
$page->content($therapy->getProperty('description'));
}
$pages->addPage($page, $route);
}
} What is the best way to add such objects to the index? |
So let me get this straight.. if you go to the route |
A working page. It can't find my route in a routes list ( /**
* Find a page based on route.
*
* @param string $route The route of the page
* @param bool $all If true, return also non-routable pages, otherwise return null if page isn't routable
* @return PageInterface|null
*/
public function find($route, $all = false)
{
$route = urldecode((string)$route);
// Fetch page if there's a defined route to it.
$path = $this->routes[$route] ?? null; //HERE Same with |
I prepared my sitemap for indexing Flex objects as described here:
https://getgrav.org/premium/algolia-pro/docs/backend#crawl-page-search-intermediate
Code in my plugin:
I use

#therapy
body selector:But I can't start indexing:
Same index name, as you can see. In Algolia it has proper name:

I also tried with additional index parameter:
The same error. What's this?
P.S. What I found about this error:
symfony/symfony#47244
fr05t1k/codeception-progress-reporter#12
The text was updated successfully, but these errors were encountered: