algoliasearch-client-python icon indicating copy to clipboard operation
algoliasearch-client-python copied to clipboard

Add quick check to PaginatorIterator to check if the hits dictionary …

Open ryancambray-ct opened this issue 3 years ago • 0 comments
trafficstars

…contains the element '_highlightResult'

This is to avoid the iterators file throwing a KeyError when the element does not contain this.

Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue Fix #544
Need Doc update yes/no

Describe your change

Checks if the hit element contains the key '_highlightResult' before removing it from the element.

What problem is this fixing?

When batch saving rules called from the browse_rules API call, the RuleIterator throws a KeyError if the rule element does not contain the key '_highlightResult'. This is a rare occurrence but it is possible.

ryancambray-ct avatar Jan 14 '22 17:01 ryancambray-ct