629 | | foreach ( $this->queries as $query ) { |
| 629 | // convert AND queries to IN ones for more efficient SQL |
| 630 | if ( 'AND' == $this->relation ) { |
| 631 | $final_queries = array(); |
| 632 | foreach ( $this->queries as $query ) { |
| 633 | if ( 'AND' == $query['operator'] && count( $query['terms'] ) <= 10 ) { |
| 634 | foreach ( $query['terms'] as $term ) { |
| 635 | $final_queries[] = array_merge( $query, array( |
| 636 | 'terms' => $term, |
| 637 | 'operator' => 'IN' |
| 638 | ) ); |
| 639 | } |
| 640 | } else { |
| 641 | $final_queries[] = $query; |
| 642 | } |
| 643 | } |
| 644 | } else { |
| 645 | $final_queries = $this->queries; |
| 646 | } |
| 647 | |
| 648 | foreach ( $final_queries as $query ) { |