<commit_before><?php
namespace Concrete\Core\Search\Field\Field;

use Concrete\Core\File\FileList;
use Concrete\Core\Search\Field\AbstractField;
use Concrete\Core\Search\ItemList\ItemList;

class KeywordsField extends AbstractField
{
    public function __construct($keywords = null)
    {
        if ($keywords) {
            $this->data['keywords'] = $keywords;
        }
    }

    protected $requestVariables = [
        'keywords',
    ];

    public function getKey()
    {
        return 'keywords';
    }

    public function getDisplayName()
    {
        return t('Keywords');
    }

    /**
     * @param FileList $list
     * @param $request
     */
    public function filterList(ItemList $list)
    {
        $keywords = $this->data['keywords'];
        $list->filterByKeywords($keywords);
    }

    public function renderSearchField()
    {
        $form = \Core::make('helper/form');

        return $form->text('keywords', $this->data['keywords']);
    }
}<commit_msg>Avoid accessing an undefined array index in KeywordsField<commit_after><?php
namespace Concrete\Core\Search\Field\Field;

use Concrete\Core\File\FileList;
use Concrete\Core\Search\Field\AbstractField;
use Concrete\Core\Search\ItemList\ItemList;

class KeywordsField extends AbstractField
{
    public function __construct($keywords = null)
    {
        if ($keywords) {
            $this->data['keywords'] = $keywords;
        }
    }

    protected $requestVariables = [
        'keywords',
    ];

    public function getKey()
    {
        return 'keywords';
    }

    public function getDisplayName()
    {
        return t('Keywords');
    }

    /**
     * @param FileList $list
     * @param $request
     */
    public function filterList(ItemList $list)
    {
        $keywords = $this->data['keywords'];
        $list->filterByKeywords($keywords);
    }

    public function renderSearchField()
    {
        $form = \Core::make('helper/form');

        return $form->text('keywords', isset($this->data['keywords']) ? $this->data['keywords'] : '');
    }
}
{'fraction_non_alphanumeric': 0.13777994157740994, 'fraction_numerical': 0.0, 'mean_word_length': 2.5739130434782607, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '128460', 'n_tokens_mistral': 625, 'n_tokens_neox': 590, 'n_words': 116}