Skip to content
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

Fix ReindexAllJob error using class name for index name #71

Merged
merged 2 commits into from
Jul 18, 2024

Conversation

matt-in-a-hat
Copy link
Contributor

No description provided.

e.g. with the set up below it was giving the error "Index SilverStripe\CMS\Model\SiteTree not found, must be one of [Page]"
      indexes:
        Page:
          includeClasses:
            - SilverStripe\CMS\Model\SiteTree
$errors = [];
if (!in_array($class, $classes)) {
continue;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this diff looks so ugly, all that changed was I wrapped the meat of this in

foreach ($algoliaService->indexes as $indexName => $index) {
  $classes = (isset($index['includeClasses'])) ? $index['includeClasses'] : [];

  if (!in_array($class, $classes)) {
    continue;
  }

And changed the indexItems to take $indexName instead of $class

@wilr wilr merged commit c584e2a into wilr:main Jul 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants