protected function clearRecords(SolrIndex $indexInstance, $class, $groups = null, $group = null)
    {
        // Clear by classname
        $conditions = array("+(ClassHierarchy:{$class})");

        // If grouping, delete from this group only
        if ($groups) {
            $conditions[] = "+_query_:\"{!frange l={$group} u={$group}}mod(ID, {$groups})\"";
        }

        // Also filter by state (suffix on document ID)
        $query = new SearchQuery();
        SearchVariant::with($class)
            ->call('alterQuery', $query, $indexInstance);
        if ($query->isfiltered()) {
            $conditions = array_merge($conditions, $indexInstance->getFiltersComponent($query));
        }

        // Invoke delete on index
        $deleteQuery = implode(' ', $conditions);
        $indexInstance
            ->getService()
            ->deleteByQuery($deleteQuery);
    }
protected function clearRecords(SolrIndex $indexInstance, $class, $groups = null, $group = null)
    {
        // Clear by classname
        $conditions = array("+(ClassHierarchy:{$class})");

        // If grouping, delete from this group only
        if ($groups) {
            $conditions[] = "+_query_:\"{!frange l={$group} u={$group}}mod(ID, {$groups})\"";
        }

        // Also filter by state (suffix on document ID)
        $query = new SearchQuery();
        SearchVariant::with($class)
            ->call('alterQuery', $query, $indexInstance);
        if ($query->isfiltered()) {
            $conditions = array_merge($conditions, $indexInstance->getFiltersComponent($query));
        }

        // Invoke delete on index
        $deleteQuery = implode(' ', $conditions);
        $indexInstance
            ->getService()
            ->deleteByQuery($deleteQuery);
    }
protected function clearRecords ( SolrIndex $ indexInstance , $ class , $ groups = null , $ group = null ) { // Clear by classname $ conditions = array ( "+(ClassHierarchy:{$class})" ) ; // If grouping, delete from this group only if ( $ groups ) { $ conditions [ ] = "+_query_:\"{!frange l={$group} u={$group}}mod(ID, {$groups})\"" ; } // Also filter by state (suffix on document ID) $ query = new SearchQuery ( ) ; SearchVariant :: with ( $ class ) -> call ( 'alterQuery' , $ query , $ indexInstance ) ; if ( $ query -> isfiltered ( ) ) { $ conditions = array_merge ( $ conditions , $ indexInstance -> getFiltersComponent ( $ query ) ) ; } // Invoke delete on index $ deleteQuery = implode ( ' ' , $ conditions ) ; $ indexInstance -> getService ( ) -> deleteByQuery ( $ deleteQuery ) ; }
Clear all records of the given class in the current state ONLY.

Optionally delete from a given group (where the group is defined as the ID % total groups)

@param SolrIndex $indexInstance Index instance
@param string $class Class name
@param int $groups Number of groups, if clearing from a striped group
@param int $group Group number, if clearing from a striped group
Clear all records of the given class in the current state ONLY .