Command/IndexerQueueCommand.php
protected function doIndexCleanup(array $types, DateTime $date = null)
    {
        $query = [];

        if ($types) {
            $query[] = 'type_name:("' . implode('" OR "', $types) . '")';
        } else {
            $query[] = '*:*';
        }

        if ($date) {
            $date = clone $date;
            $date->setTimezone(new DateTimeZone('UTC'));

            $query[] = '-_time_:[' . $date->format('Y-m-d\TG:i:s\Z') . ' TO *]';
        }

        // Delete everything else that did not got a update or does not exist anymore in the
        // database.

        $job = new Job('DELETE');
        $job->setOption('query', implode(' ', $query));

        $this->getQueue()->push($job, 1);
    }
protected function doIndexCleanup(array $types, DateTime $date = null)
    {
        $query = [];

        if ($types) {
            $query[] = 'type_name:("' . implode('" OR "', $types) . '")';
        } else {
            $query[] = '*:*';
        }

        if ($date) {
            $date = clone $date;
            $date->setTimezone(new DateTimeZone('UTC'));

            $query[] = '-_time_:[' . $date->format('Y-m-d\TG:i:s\Z') . ' TO *]';
        }

        // Delete everything else that did not got a update or does not exist anymore in the
        // database.

        $job = new Job('DELETE');
        $job->setOption('query', implode(' ', $query));

        $this->getQueue()->push($job, 1);
    }
protected function doIndexCleanup ( array $ types , DateTime $ date = null ) { $ query = [ ] ; if ( $ types ) { $ query [ ] = 'type_name:("' . implode ( '" OR "' , $ types ) . '")' ; } else { $ query [ ] = '*:*' ; } if ( $ date ) { $ date = clone $ date ; $ date -> setTimezone ( new DateTimeZone ( 'UTC' ) ) ; $ query [ ] = '-_time_:[' . $ date -> format ( 'Y-m-d\TG:i:s\Z' ) . ' TO *]' ; } // Delete everything else that did not got a update or does not exist anymore in the // database. $ job = new Job ( 'DELETE' ) ; $ job -> setOption ( 'query' , implode ( ' ' , $ query ) ) ; $ this -> getQueue ( ) -> push ( $ job , 1 ) ; }
delete all the types or everything if none is given

@param array $types
@param DateTime $date
delete all the types or everything if none is given