<commit_before><?php

namespace Client\Bundle\WebsiteBundle\Controller;

use Massive\Bundle\SearchBundle\Search\SearchManagerInterface;
use Sulu\Bundle\WebsiteBundle\Controller\WebsiteController;
use Sulu\Component\Rest\RequestParametersTrait;
use Sulu\Component\Webspace\Analyzer\RequestAnalyzerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class SearchController extends WebsiteController
{
    use RequestParametersTrait;

    public function queryAction(Request $request)
    {
        $query = $this->getRequestParameter($request, 'q', true);

        /** @var SearchManagerInterface $searchManager */
        $searchManager = $this->get('massive_search.search_manager');

        /** @var RequestAnalyzerInterface $requestAnalyzer */
        $requestAnalyzer = $this->get('sulu_core.webspace.request_analyzer');
        $locale = $requestAnalyzer->getCurrentLocalization()->getLocalization();

        $hits = $searchManager
            ->createSearch(sprintf('state:published AND %s', $query))
            ->locale($locale)<commit_msg>Quote search term<commit_after><?php

namespace Client\Bundle\WebsiteBundle\Controller;

use Massive\Bundle\SearchBundle\Search\SearchManagerInterface;
use Sulu\Bundle\WebsiteBundle\Controller\WebsiteController;
use Sulu\Component\Rest\RequestParametersTrait;
use Sulu\Component\Webspace\Analyzer\RequestAnalyzerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class SearchController extends WebsiteController
{
    use RequestParametersTrait;

    public function queryAction(Request $request)
    {
        $query = $this->getRequestParameter($request, 'q', true);

        /** @var SearchManagerInterface $searchManager */
        $searchManager = $this->get('massive_search.search_manager');

        /** @var RequestAnalyzerInterface $requestAnalyzer */
        $requestAnalyzer = $this->get('sulu_core.webspace.request_analyzer');
        $locale = $requestAnalyzer->getCurrentLocalization()->getLocalization();

        $hits = $searchManager
            ->createSearch(sprintf('state:published AND "%s"', $query))
            ->locale($locale)
{'fraction_non_alphanumeric': 0.11300448430493273, 'fraction_numerical': 0.0, 'mean_word_length': 4.648101265822785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '6035631', 'n_tokens_mistral': 589, 'n_tokens_neox': 578, 'n_words': 97}