| @@ 224-239 (lines=16) @@ | ||
| 221 | $n = preg_replace( '/"/', '', $n ); |
|
| 222 | } |
|
| 223 | ||
| 224 | if ( !empty( $args['must_query_fields'] ) && !$filtering ) { |
|
| 225 | if ( $is_phrase ) { |
|
| 226 | $this->add_query( array( |
|
| 227 | 'multi_match' => array( |
|
| 228 | 'fields' => $args['must_query_fields'], |
|
| 229 | 'query' => $n, |
|
| 230 | 'type' => 'phrase', |
|
| 231 | ) ) ); |
|
| 232 | } else { |
|
| 233 | $this->add_query( array( |
|
| 234 | 'multi_match' => array( |
|
| 235 | 'fields' => $args['must_query_fields'], |
|
| 236 | 'query' => $n, |
|
| 237 | ) ) ); |
|
| 238 | } |
|
| 239 | } |
|
| 240 | ||
| 241 | if ( !empty( $args['boost_query_fields'] ) ) { |
|
| 242 | if ( $is_phrase ) { |
|
| @@ 241-256 (lines=16) @@ | ||
| 238 | } |
|
| 239 | } |
|
| 240 | ||
| 241 | if ( !empty( $args['boost_query_fields'] ) ) { |
|
| 242 | if ( $is_phrase ) { |
|
| 243 | $this->add_query( array( |
|
| 244 | 'multi_match' => array( |
|
| 245 | 'fields' => $args['boost_query_fields'], |
|
| 246 | 'query' => $n, |
|
| 247 | 'type' => 'phrase', |
|
| 248 | ) ), 'should' ); |
|
| 249 | } else { |
|
| 250 | $this->add_query( array( |
|
| 251 | 'multi_match' => array( |
|
| 252 | 'fields' => $args['boost_query_fields'], |
|
| 253 | 'query' => $n, |
|
| 254 | ) ), 'should' ); |
|
| 255 | } |
|
| 256 | } |
|
| 257 | } |
|
| 258 | ||
| 259 | if ( ! empty( $user_ids ) ) { |
|
| @@ 312-327 (lines=16) @@ | ||
| 309 | $t = preg_replace( '/"/', '', $t ); |
|
| 310 | } |
|
| 311 | ||
| 312 | if ( !empty( $args['must_query_fields'] ) ) { |
|
| 313 | if ( $is_phrase ) { |
|
| 314 | $this->add_query( array( |
|
| 315 | 'multi_match' => array( |
|
| 316 | 'fields' => $args['must_query_fields'], |
|
| 317 | 'query' => $t, |
|
| 318 | 'type' => 'phrase', |
|
| 319 | ) ) ); |
|
| 320 | } else { |
|
| 321 | $this->add_query( array( |
|
| 322 | 'multi_match' => array( |
|
| 323 | 'fields' => $args['must_query_fields'], |
|
| 324 | 'query' => $t, |
|
| 325 | ) ) ); |
|
| 326 | } |
|
| 327 | } |
|
| 328 | ||
| 329 | if ( !empty( $args['boost_query_fields'] ) ) { |
|
| 330 | if ( $is_phrase ) { |
|
| @@ 329-344 (lines=16) @@ | ||
| 326 | } |
|
| 327 | } |
|
| 328 | ||
| 329 | if ( !empty( $args['boost_query_fields'] ) ) { |
|
| 330 | if ( $is_phrase ) { |
|
| 331 | $this->add_query( array( |
|
| 332 | 'multi_match' => array( |
|
| 333 | 'fields' => $args['boost_query_fields'], |
|
| 334 | 'query' => $t, |
|
| 335 | 'type' => 'phrase', |
|
| 336 | ) ), 'should' ); |
|
| 337 | } else { |
|
| 338 | $this->add_query( array( |
|
| 339 | 'multi_match' => array( |
|
| 340 | 'fields' => $args['boost_query_fields'], |
|
| 341 | 'query' => $t, |
|
| 342 | ) ), 'should' ); |
|
| 343 | } |
|
| 344 | } |
|
| 345 | } |
|
| 346 | ||
| 347 | return true; |
|