protected function executeIndex(InputInterface $input, OutputInterface $output)
    {
        // Don't hydrate for performance reasons
        $builder = $this->getDocumentManager()->createQueryBuilder(Content::class);
        $builder->select('id', 'contentType', 'class')->hydrate(false);

        if ($input->getOption('full')) {
            $result = $builder->getQuery()->execute();

            // The entire site is going to be reindex so everything that is now in the queue
            // will be redone so just clear it so content is not double indexed.

            $this->getQueue()->clear();
        } else {
            $builder->field('contentType')->in($input->getArgument('id'));

            $result = $builder->getQuery()->execute();
        }

        if ($count = $result->count()) {
            $progress = $this->getProgress();

            $progress->setRedrawFrequency(min(max(floor($count / 250), 1), 100));
            $progress->setFormat(ProgressHelper::FORMAT_VERBOSE);

            $progress->start($output, $count);

            // get the current time as it will be required at the end for the solr clean up.

            $date = new DateTime();

            $this->doIndex($result, $progress);
            $this->doIndexCleanup($input->getArgument('id'), $date);
            $this->doIndexCommit();

            $progress->display();
            $progress->finish();
        } else {
            // No content was found but that does not mean nothing should be done. As the solr
            // index should reflect the database so delete all the content for the matching
            // content types out the solr index.

            $this->doIndexCleanup($input->getArgument('id'));
            $this->doIndexCommit();
        }

        $this->getDocumentManager()->clear();

        return 0;
    }