private function convertContextIntoQueryString(Context $context) : string
 {
     return implode(' AND ', array_map(function ($contextCode) use($context) {
         $fieldName = $this->escapeQueryChars($contextCode);
         $fieldValue = $this->escapeQueryChars($context->getValue($contextCode));
         return sprintf('((-%1$s:[* TO *] AND *:*) OR %1$s:"%2$s")', $fieldName, $fieldValue);
     }, $context->getSupportedCodes()));
 }
 /**
  * @param Context $context
  * @return string[]
  */
 private function getContextAsArray(Context $context)
 {
     return array_reduce($context->getSupportedCodes(), function (array $carry, $contextCode) use($context) {
         $carry[$contextCode] = $context->getValue($contextCode);
         return $carry;
     }, []);
 }
 /**
  * @param Context $context
  * @return string[]
  */
 private static function getContextFields(Context $context) : array
 {
     return array_reduce($context->getSupportedCodes(), function ($carry, $contextCode) use($context) {
         return array_merge([$contextCode => $context->getValue($contextCode)], $carry);
     }, []);
 }