Return field faceted data from faceted search result.

@param string $field Facet field.

@return array
339907
public function getFacetedData($field)
    {
        $this->_renderFilters();
        $result = [];
        $aggregations = $this->queryResponse->getAggregations();

        $bucket = $aggregations->getBucket($field);

        if ($bucket) {
            foreach ($bucket->getValues() as $value) {
                $metrics = $value->getMetrics();
                $result[$value->getValue()] = $metrics;
            }
        }

        return $result;
    }
104435
public function referredIn($field)
    {
        $result = [];
        foreach ($this->relations as $relation) {
            if (false === $i = array_search($field, $relation->localKeys())) {
                continue;
            }

            $result[$relation->foreignKeys()[$i]] = $relation;
        }

        return $result;
    }
472906
public function getFormData($field = null)
    {
        $filters = session('bzarzuela.filters');

        if (isset($filters[$this->key]['form_data'])) {

            if (! is_null($field)) {

                if (! isset($filters[$this->key]['form_data'][$field])) {
                    return null;
                }

                return $filters[$this->key]['form_data'][$field];
            }

            return $filters[$this->key]['form_data'];
        }

        if (! is_null($field)) {
            return null;
        }

        return [];
    }
1107797
protected function field(array $field)
    {
        if (!empty($field['fields'])) {
            $result = $this->fieldset($field);
        } else {
            $result = $this->element($field);
        }
        return $result;
    }
487129
public function getFieldErrors(string $field): array {
        if (empty($this->errors[$field])) {
            return [];
        } else {
            $result = [];
            foreach ($this->errors[$field] as $error) {
                $result[] = $this->pluckError($error + ['field' => $field]);
            }
            return $result;
        }
    }
664179
public function fieldQuery($field)
    {
        $query = $this->dsql()->del('fields');
        if (is_string($field)) {
            $field = $this->getElement($field);
        }
        $field->updateSelectQuery($query);

        return $query;
    }
859668
public function getFieldHistory(string $field) : Collection
    {
        return $this->revisions->map(function ($revision) use ($field) : ?array {
            if ($revision->old($field) == $revision->new($field)) {
                return null;
            }

            return [
                'created_at' => (string) $revision->created_at,
                'user_id' => $revision->executor->id ?? null,
                'user_email' => $revision->executor->email ?? null,
                'old' => $revision->old($field),
                'new' => $revision->new($field),
            ];
        })->filter()->values();
    }
470262
private function getPlainField($field)
    {
        if (!isset($this->fields[$field['name']])) {                     
			$this->fields[$field['name']] = $this->getDbConnection()->fetchColumn('SELECT `'.$field['name'].'` FROM '.$this->table.' WHERE id='.(int)$this->fields['id']);
		}
        return $this->fields[$field['name']];
    }
812167
public function fields( $field = null, $option = null ) {

		$field_data = null;

		if ( empty( $this->fields ) ) {
			// No fields found.
			$field_data = array();
		} elseif ( empty( $field ) ) {
			// Return all fields.
			$field_data = (array) $this->fields;
		} elseif ( ! isset( $this->fields[ $field ] ) && ! isset( $this->pod_data['object_fields'][ $field ] ) ) {
			// Field not found.
			$field_data = array();
		} elseif ( empty( $option ) ) {
			// Return all field data.
			if ( isset( $this->fields[ $field ] ) ) {
				$field_data = $this->fields[ $field ];
			} elseif ( isset( $this->pod_data['object_fields'] ) ) {
				$field_data = $this->pod_data['object_fields'][ $field ];
			}
		} else {
			$options = array();

			// Merge options.
			if ( isset( $this->fields[ $field ] ) ) {
				$options = array_merge( $this->fields[ $field ], $this->fields[ $field ]['options'] );
			} elseif ( isset( $this->pod_data['object_fields'] ) ) {
				$options = array_merge( $this->pod_data['object_fields'][ $field ], $this->pod_data['object_fields'][ $field ]['options'] );
			}

			if ( 'data' === $option && in_array( pods_v( 'type', $options ), PodsForm::tableless_field_types(), true ) ) {
				// Get a list of available items from a relationship field.
				$field_data = PodsForm::field_method( 'pick', 'get_field_data', $options );
			} elseif ( isset( $options[ $option ] ) ) {
				// Return option.
				$field_data = $options[ $option ];
			}
		}//end if

		/**
		 * Modify the field data before returning
		 *
		 * @since unknown
		 *
		 * @param array       $field_data The data for the field.
		 * @param string|null $field      The specific field that data is being return for, if set when method is called or null.
		 * @param string|null $option     Value of option param when method was called. Can be used to get a list of available items from a relationship field.
		 * @param Pods|object $this       The current Pods class instance.
		 */
		return apply_filters( 'pods_pods_fields', $field_data, $field, $option, $this );

	}
435232
public function getField($field)
    {
        // Skip invalid fields
        $fields = $this->compositeDatabaseFields();
        if (!isset($fields[$field])) {
            return null;
        }

        // Check bound object
        if ($this->record instanceof DataObject) {
            $key = $this->getName() . $field;
            return $this->record->getField($key);
        }

        // Check local record
        if (isset($this->record[$field])) {
            return $this->record[$field];
        }
        return null;
    }
540510
public static function getField($field)
    {
        return isset(self::$fields[$field]) ? self::$fields[$field] : null;
    }
259872
private static function getFieldTypeArray($fields)
    {
        if (count($fields) === 0) {
            return;
        }

        $types = array();

        foreach ($fields as &$field) {
            $types[] = $field->type;
        }

        return $types;
    }
163812
public function value($field)
    {
        if (is_array($field)) {
            $values = array();
            foreach ($field as $key => $value) {
                $values[$key] = $this->value($value);
            }

            return $values;
        }

        return ($this->submitted && isset($this->values[$field])) ? $this->values[$field] : null;
    }
1053971
public function values($field)
    {
        $values = [];
        foreach ($this->distinct()->select([$field])->all() as $v) {
            $values[] = $v[$field];
        }

        return $values;
    }
134137
public function getField($field)
    {
        if (!$this->isFieldSupported($field)) {
            return null;
        }

        if (!$this->hasLoadedField($field)) {
            $loaderData = $this->getLoaderData($field);
            if (isset($this->normalizersMap[$field])) {
                $normalizerName = $this->normalizersMap[$field];
                $normalizerFunction = sprintf('%sNormalizer', $normalizerName);
                $this->fields[$field] = $this->$normalizerFunction($loaderData);
            } else {
                $this->fields[$field] = $loaderData;
            }
        }

        return parent::getField($field);
    }
376874
protected function getInheritedParams($field)
    {
        $pages = Grav::instance()['pages'];

        /** @var Pages $pages */
        $inherited = $pages->inherited($this->route, $field);
        $inheritedParams = $inherited ? (array)$inherited->value('header.' . $field) : [];
        $currentParams = (array)$this->value('header.' . $field);
        if ($inheritedParams && is_array($inheritedParams)) {
            $currentParams = array_replace_recursive($inheritedParams, $currentParams);
        }

        return [$inherited, $currentParams];
    }
474706
private function getSearchField($field)
    {
        if ($this->isStringDQLQuery($field)) {

            $dqlQuery = $field;

            $lexer = new Query\Lexer($field);

            // We have to rename some identifier or the execution will crash
            do {
                $lexer->moveNext();

                if ($this->isTheIdentifierILookingFor($lexer)) {

                    $replacement = sprintf("$1%s_%d$3", $lexer->lookahead['value'], mt_rand());
                    $pattern = sprintf("/([\(\s])(%s)([\s\.])/", $lexer->lookahead['value']);

                    $dqlQuery = preg_replace($pattern, $replacement, $dqlQuery);
                }

            } while($lexer->lookahead !== null);

            $dqlQuery = substr($dqlQuery, 0, strripos($dqlQuery, ")") + 1);

            return $dqlQuery;
        }

        $field = explode(' ', trim($field));

        return $field[0];
    }