-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Index-Name, using ResourceChannel, ResourceLocation and Resourc…
…eLangauge
- Loading branch information
Showing
178 changed files
with
12,469 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
!var/cache/.gitkeep | ||
/var/log/* | ||
!var/log/.gitkeep | ||
/var/test/* | ||
/tools | ||
.phpactor.json | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
[![codecov](https://codecov.io/gh/sitepark/atoolo-resource/graph/badge.svg?token=QwvDRxKEa2)](https://codecov.io/gh/sitepark/atoolo-resource) | ||
[![codecov](https://codecov.io/gh/sitepark/atoolo-search/graph/badge.svg?token=xBMwUzm34b)](https://codecov.io/gh/sitepark/atoolo-search) | ||
![phpstan](https://img.shields.io/badge/PHPStan-level%209-brightgreen) | ||
![php](https://img.shields.io/badge/PHP-8.1-blue) | ||
![php](https://img.shields.io/badge/PHP-8.2-blue) | ||
![php](https://img.shields.io/badge/PHP-8.3-blue) | ||
|
||
# Atoolo search | ||
|
||
Provides services with which a Solr index can be filled and searched for [resources](https://github.com/sitepark/atoolo-resource) via this index. | ||
Provides services with which a Solr index can be filled and searched for [resources](https://github.com/sitepark/atoolo-resource) via a index. | ||
|
||
[Documentation](https://sitepark.github.io/atoolo-docs/develop/components/search/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
// application.php | ||
|
||
require __DIR__.'/../vendor/autoload.php'; | ||
|
||
use Atoolo\Search\Console\Application; | ||
use Symfony\Component\Config\FileLocator; | ||
|
||
$container = new Symfony\Component\DependencyInjection\ContainerBuilder(); | ||
$loader = new Symfony\Component\DependencyInjection\Loader\YamlFileLoader( | ||
$container, | ||
new FileLocator(__DIR__ . '/../config')); | ||
|
||
$loader->load('commands.yml'); | ||
$container->compile(); | ||
|
||
$application = $container->get(Application::class); | ||
|
||
$application->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
_instanceof: | ||
Symfony\Component\Console\Command\Command: | ||
tags: ['command'] | ||
|
||
Atoolo\Search\Console\: | ||
resource: '../src/Console' | ||
|
||
atoolo.search.indexer.console.progressBar: | ||
class: 'Atoolo\Search\Console\Command\Io\IndexerProgressBar' | ||
|
||
Atoolo\Search\Console\Command\Indexer: | ||
arguments: | ||
- '@atoolo.resource.resourceChannelFactory' | ||
- '@atoolo.search.indexer.console.progressBar' | ||
- '@atoolo.search.indexer.indexerCollection' | ||
|
||
Atoolo\Search\Console\Command\IndexerInternalResourceUpdate: | ||
arguments: | ||
- '@atoolo.resource.resourceChannelFactory' | ||
- '@atoolo.search.indexer.console.progressBar' | ||
- '@atoolo.search.indexer.internalResourceIndexer' | ||
|
||
Atoolo\Search\Console\Command\Search: | ||
arguments: | ||
- '@atoolo.resource.resourceChannelFactory' | ||
- '@atoolo.search.search' | ||
|
||
Atoolo\Search\Console\Command\Suggest: | ||
arguments: | ||
- '@atoolo.resource.resourceChannelFactory' | ||
- '@atoolo.search.suggest' | ||
|
||
Atoolo\Search\Console\Command\MoreLikeThis: | ||
arguments: | ||
- '@atoolo.resource.resourceChannelFactory' | ||
- '@atoolo.search.moreLikeThis' | ||
|
||
Atoolo\Search\Console\Command\DumpIndexDocument: | ||
arguments: | ||
- '@atoolo.resource.resourceChannelFactory' | ||
- '@atoolo.search.indexer.indexDocumentDumper' | ||
|
||
Atoolo\Search\Console\Application: | ||
public: true | ||
arguments: | ||
- !tagged command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Atoolo\Search\Console; | ||
|
||
use Symfony\Component\Console\Application as BaseApplication; | ||
use Symfony\Component\Console\Command\Command; | ||
|
||
class Application extends BaseApplication | ||
{ | ||
/** | ||
* @param iterable<Command> $commands | ||
*/ | ||
public function __construct(iterable $commands = []) | ||
{ | ||
parent::__construct(); | ||
foreach ($commands as $command) { | ||
$this->add($command); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Atoolo\Search\Console\Command; | ||
|
||
use Atoolo\Resource\ResourceChannelFactory; | ||
use Atoolo\Search\Console\Command\Io\TypifiedInput; | ||
use Atoolo\Search\Service\Indexer\IndexDocumentDumper; | ||
use JsonException; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
#[AsCommand( | ||
name: 'search:dump-index-document', | ||
description: 'Dump a index document' | ||
)] | ||
class DumpIndexDocument extends Command | ||
{ | ||
public function __construct( | ||
private readonly ResourceChannelFactory $channelFactory, | ||
private readonly IndexDocumentDumper $dumper | ||
) { | ||
parent::__construct(); | ||
} | ||
|
||
protected function configure(): void | ||
{ | ||
$this | ||
->setHelp('Command to dump a index-document') | ||
->addArgument( | ||
'paths', | ||
InputArgument::REQUIRED | InputArgument::IS_ARRAY, | ||
'Resources paths or directories of resources to be indexed.' | ||
) | ||
; | ||
} | ||
|
||
/** | ||
* @throws JsonException | ||
*/ | ||
protected function execute( | ||
InputInterface $input, | ||
OutputInterface $output | ||
): int { | ||
|
||
$typedInput = new TypifiedInput($input); | ||
|
||
$paths = $typedInput->getArrayArgument('paths'); | ||
|
||
$resourceChannel = $this->channelFactory->create(); | ||
$io = new SymfonyStyle($input, $output); | ||
$io->title('Channel: ' . $resourceChannel->name); | ||
|
||
$dump = $this->dumper->dump($paths); | ||
|
||
foreach ($dump as $fields) { | ||
$output->writeln(json_encode( | ||
$fields, | ||
JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | ||
)); | ||
} | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
Oops, something went wrong.