Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/store/src/Command/IndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$io->title(\sprintf('Indexing documents using "%s" indexer', $indexer));

$description = $indexerService->getDescription();
if (null !== $description) {
$io->info($description);
}

try {
$indexerService->index([]);

Expand Down
8 changes: 7 additions & 1 deletion src/store/src/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ public function __construct(
private StoreInterface $store,
string|array|null $source = null,
private array $transformers = [],
private ?string $description = null,
private LoggerInterface $logger = new NullLogger(),
) {
$this->sources = null === $source ? [] : (array) $source;
}

public function withSource(string|array $source): self
{
return new self($this->loader, $this->vectorizer, $this->store, $source, $this->transformers, $this->logger);
return new self($this->loader, $this->vectorizer, $this->store, $source, $this->transformers, $this->description, $this->logger);
}

public function index(array $options = []): void
Expand Down Expand Up @@ -96,6 +97,11 @@ public function index(array $options = []): void
$this->logger->debug('Document processing completed', ['total_documents' => $counter]);
}

public function getDescription(): ?string
{
return $this->description;
}

/**
* @return TextDocument[]
*/
Expand Down
5 changes: 5 additions & 0 deletions src/store/src/IndexerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ public function index(array $options = []): void;
* @param string|array<string> $source Source identifier (file path, URL, etc.) or array of sources
*/
public function withSource(string|array $source): self;

/**
* Get the description of what this indexer does.
*/
public function getDescription(): ?string;
}