Skip to content

Commit d3bb9c9

Browse files
Merge pull request #388 from mgburns/385-add-facet-operator-filter
Add filter for facet operator
2 parents a0cd157 + cac4b70 commit d3bb9c9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

includes/class-solrpower-wp-query.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ function the_posts( $posts, $query ) {
406406
function parse_facets( $query ) {
407407
$plugin_s4wp_settings = solr_options();
408408
$default_operator = ( isset( $plugin_s4wp_settings['s4wp_default_operator'] ) ) ? $plugin_s4wp_settings['s4wp_default_operator'] : 'OR';
409+
$facet_operator = apply_filters( 'solr_facet_operator', $default_operator );
409410

410411
$facets = $query->get( 'facet' );
411412
if ( ! $facets ) {
@@ -415,7 +416,7 @@ function parse_facets( $query ) {
415416
if ( is_array( $this->fq ) && ! empty( $this->fq ) ) {
416417
$return = $this->fq;
417418

418-
return implode( ' ' . $default_operator . ' ', $return );
419+
return implode( ' ' . $facet_operator . ' ', $return );
419420
}
420421

421422
return array();
@@ -433,7 +434,7 @@ function parse_facets( $query ) {
433434
// Additional Filter Query.
434435
$return = array_merge( $return, $this->fq );
435436

436-
return implode( ' ' . $default_operator . ' ', $return );
437+
return implode( ' ' . $facet_operator . ' ', $return );
437438

438439
}
439440

0 commit comments

Comments
 (0)