Automattic / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
20 stars 7 forks source link

fallback to empty array if no _source in hit #172

Closed pschoffer closed 2 years ago

pschoffer commented 2 years ago

Description

Adding a null check to $hit[_source] for instances when source is not returned.

This scenario happens for instance in our count validation logic. We by design suppress _source which includes documents' content to limit the amount of data needed to transfer as we are only interested in count in that specific scenario.

Checklist

Please make sure the items below have been covered before requesting a review:

Upstream PR - https://github.com/10up/ElasticPress/pull/2992

Steps to Test

1) vip dev-env exec -- wp vip-search health validate-counts 2) No warnings