public function addToLastSearches($keywords)
    {
        $mode = $this->configuration->getSearchLastSearchesMode();
        switch ($mode) {
            case 'user':
                $this->storeKeywordsToSession($keywords);
                break;
            case 'global':
                $this->lastSearchesRepository->add($keywords, (int)$this->configuration->getSearchLastSearchesLimit());
                break;
            default:
                throw new \UnexpectedValueException(
                    'Unknown mode for plugin.tx_solr.search.lastSearches.mode, valid modes are "user" or "global".',
                    1342456570
                );
        }
    }
public function addToLastSearches($keywords)
    {
        $mode = $this->configuration->getSearchLastSearchesMode();
        switch ($mode) {
            case 'user':
                $this->storeKeywordsToSession($keywords);
                break;
            case 'global':
                $this->lastSearchesRepository->add($keywords, (int)$this->configuration->getSearchLastSearchesLimit());
                break;
            default:
                throw new \UnexpectedValueException(
                    'Unknown mode for plugin.tx_solr.search.lastSearches.mode, valid modes are "user" or "global".',
                    1342456570
                );
        }
    }
public function addToLastSearches ( $ keywords ) { $ mode = $ this -> configuration -> getSearchLastSearchesMode ( ) ; switch ( $ mode ) { case 'user' : $ this -> storeKeywordsToSession ( $ keywords ) ; break ; case 'global' : $ this -> lastSearchesRepository -> add ( $ keywords , ( int ) $ this -> configuration -> getSearchLastSearchesLimit ( ) ) ; break ; default : throw new \ UnexpectedValueException ( 'Unknown mode for plugin.tx_solr.search.lastSearches.mode, valid modes are "user" or "global".' , 1342456570 ) ; } }
Saves the keywords to the last searches in the database or session depending on the configuration.

@param string $keywords
@throws \UnexpectedValueException
Saves the keywords to the last searches in the database or session depending on the configuration .