Skip to content

Commit

Permalink
Merge pull request #2992 from Automattic/udate/check_for_source_upstream
Browse files Browse the repository at this point in the history
fallback to empty array if no _source in hit
  • Loading branch information
felipeelia authored Oct 17, 2022
2 parents 19db94a + 7e210d9 commit 926fa3b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/classes/Elasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ public function query( $index, $type, $query, $query_args, $query_object = null
$documents = [];

foreach ( $hits as $hit ) {
$document = $hit['_source'];
$document = isset( $hit['_source'] ) ? $hit['_source'] : array();
$document['site_id'] = $this->parse_site_id( $hit['_index'] );

if ( ! empty( $hit['highlight'] ) ) {
Expand Down

0 comments on commit 926fa3b

Please sign in to comment.