protected function determineBestMinimumInputLength()
    {
        $info = $this->getModelInformation(get_class($this->model));

        // Check if this is a multiple-model (morphTo), get the target models.
        $models = $this->getReferenceDataProvider()->getNestedModelClassesByType(
            $info,
            'form.field',
            $this->field->key()
        );

        if ($models && count($models)) {

            $total = array_reduce($models, function ($carry, $modelClass) {
                return $carry + $this->getCountForModel($modelClass);
            });

        } else {
            // Otherwise, rely on the reference data to provide
            $referenceData = $this->getReferenceDataProvider()
                ->getForInformationByType($info, 'form.field', $this->field->key());

            if (false === $referenceData) {
                return 1;
            }

            $total = $this->getCountForModel($referenceData->model());
        }

        if (null === $total) {
            return 1;
        }

        if ($total > static::AUTOCOMPLETE_INPUT_THRESHOLD_THREE) {
            return 3;
        }

        if ($total > static::AUTOCOMPLETE_INPUT_THRESHOLD_TWO) {
            return 2;
        }

        if ($total > static::AUTOCOMPLETE_INPUT_THRESHOLD_ONE) {
            return 1;
        }

        return 0;
    }