-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Bug
nodeindex:build indexes all nodes into the current (old) index via the alias, then switches the alias to the new (empty) index. Expected behavior is to index into the new index first, then switch the alias.
Cause
NodeIndexCommandController injects the concrete NodeIndexer class:
/**
* @Flow\Inject
* @var NodeIndexer
*/
protected $nodeIndexer;When Flowpack.ElasticSearch.ContentRepositoryQueueIndexer is installed, its Objects.yaml overrides NodeIndexerInterface to point to ContentRepositoryQueueIndexer\Indexer\NodeIndexer. This creates two separate singleton instances:
- Instance A (
ContentRepositoryAdaptor\Indexer\NodeIndexer) – used byNodeIndexCommandController - Instance B (
ContentRepositoryQueueIndexer\Indexer\NodeIndexer) – used byNodeIndexingManager(injected viaNodeIndexerInterface)
configureNodeIndexer() sets the postfix on Instance A, but WorkspaceIndexer → NodeIndexingManager → flushQueues() calls indexNode() on Instance B, which has no postfix. getIndexName() returns the alias name, so Elasticsearch routes documents to the old index.
Suggested fix
Inject NodeIndexerInterface instead of the concrete class in NodeIndexCommandController:
use Neos\ContentRepository\Search\Indexer\NodeIndexerInterface;
/**
* @Flow\Inject
* @var NodeIndexerInterface
*/
protected $nodeIndexer;Related
- NodeIndexer must be marked singleton Flowpack.ElasticSearch.ContentRepositoryQueueIndexer#42
- BUGFIX: Use NodeIndexerInterface in IndexingJob Flowpack.ElasticSearch.ContentRepositoryQueueIndexer#48
- Revert "BUGFIX: Use NodeIndexerInterface in IndexingJob" Flowpack.ElasticSearch.ContentRepositoryQueueIndexer#52