public function addQuery(Search $query, $modeManualAction = null) {
        if($modeManualAction && $this->data['mode'] != 'manual') {
            throw new \InvalidArgumentException('Query mode must be set to "manual" before using a batchAction for queries.');
        }
	    //add query data
	    $queryArray = json_decode($query->getData(), true);
	    //add batchAction if any
	    if($modeManualAction) {
	        $queryArray['batchAction'] = $modeManualAction;
	    }
        //add template if any
	    $template = $query->getTemplate();
	    if(!empty($template)) {
	        $queryArray['template'] = $template;
	        $suffix = 'Template';
	    } else { 
            $suffix = '';	        
	    }
    	//add type of query
    	$type = get_class($query);
	    switch($type) {
	        case 'OpenSearchServer\Search\Field\Search':
    	        $queryArray['type'] = 'SearchField'.$suffix;
        	    break;
	        case 'OpenSearchServer\Search\Pattern\Search':
        	    $queryArray['type'] = 'SearchPattern'.$suffix;
        	    break;
	    }
	    $this->data['queries'][] = $queryArray;
	}
public function addQuery(Search $query, $modeManualAction = null) {
        if($modeManualAction && $this->data['mode'] != 'manual') {
            throw new \InvalidArgumentException('Query mode must be set to "manual" before using a batchAction for queries.');
        }
	    //add query data
	    $queryArray = json_decode($query->getData(), true);
	    //add batchAction if any
	    if($modeManualAction) {
	        $queryArray['batchAction'] = $modeManualAction;
	    }
        //add template if any
	    $template = $query->getTemplate();
	    if(!empty($template)) {
	        $queryArray['template'] = $template;
	        $suffix = 'Template';
	    } else { 
            $suffix = '';	        
	    }
    	//add type of query
    	$type = get_class($query);
	    switch($type) {
	        case 'OpenSearchServer\Search\Field\Search':
    	        $queryArray['type'] = 'SearchField'.$suffix;
        	    break;
	        case 'OpenSearchServer\Search\Pattern\Search':
        	    $queryArray['type'] = 'SearchPattern'.$suffix;
        	    break;
	    }
	    $this->data['queries'][] = $queryArray;
	}
public function addQuery ( Search $ query , $ modeManualAction = null ) { if ( $ modeManualAction && $ this -> data [ 'mode' ] != 'manual' ) { throw new \ InvalidArgumentException ( 'Query mode must be set to "manual" before using a batchAction for queries.' ) ; } //add query data $ queryArray = json_decode ( $ query -> getData ( ) , true ) ; //add batchAction if any if ( $ modeManualAction ) { $ queryArray [ 'batchAction' ] = $ modeManualAction ; } //add template if any $ template = $ query -> getTemplate ( ) ; if ( ! empty ( $ template ) ) { $ queryArray [ 'template' ] = $ template ; $ suffix = 'Template' ; } else { $ suffix = '' ; } //add type of query $ type = get_class ( $ query ) ; switch ( $ type ) { case 'OpenSearchServer\Search\Field\Search' : $ queryArray [ 'type' ] = 'SearchField' . $ suffix ; break ; case 'OpenSearchServer\Search\Pattern\Search' : $ queryArray [ 'type' ] = 'SearchPattern' . $ suffix ; break ; } $ this -> data [ 'queries' ] [ ] = $ queryArray ; }
Add one query to the batch
@param Search $query
@param String $modeManualAction Batch action to use for the query, if mode is "manual"
Add one query to the batch