Upon development I want to reindex only specific categories because reindexing takes too long.
Therefore I am whipping a quick commang where I need to provide a category url and from that triggerring via object manager the reindexing of products and anything else required for this particular category.
namespace PcmagasTasksConsoleCommand;
use SymfonyComponentConsoleCommandCommand;
use SymfonyComponentConsoleInputInputInterface;
use SymfonyComponentConsoleOutputOutputInterface;
class PartialCategoryReindexer extends Command
{
public function __construct(ObjectManagerInterface $objectManager)
{
$this->objectManager = $objectManager;
parent::__construct(null);
}
public function execute(InputInterface $input,OutputInterface $output)
{
$url = $input->get('url');
$path = parse_url($url, PHP_URL_PATH);
// Trigger reindex here
}
}
But how I can search for categories based upon url?