<commit_before><?php

namespace Bolt\Provider;

use Bolt\Storage\Query\ContentQueryParser;
use Bolt\Storage\Query\FrontendQueryScope;
use Bolt\Storage\Query\Query;
use Bolt\Storage\Query\QueryParameterParser;
use Bolt\Storage\Query\SearchConfig;
use Bolt\Storage\Query\SearchQuery;
use Bolt\Storage\Query\SearchWeighter;
use Bolt\Storage\Query\SelectQuery;
use Silex\Application;
use Silex\ServiceProviderInterface;

class QueryServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        $app['query'] = function ($app) {
            $runner = new Query($app['query.parser']);
            $runner->addScope('frontend', $app['query.scope.frontend']);

            return $runner;
        };

        $app['query.parser'] = function ($app) {
            $parser = new ContentQueryParser($app['storage']);
            $parser->addService('select', $app['query.select']);
            $parser->addService('search', $app['query.search']);
            $parser->addService('search_weighter', $app['query.search_weighter']);
            $parser->addService('search_config', $app['query.search_config']);
            $parser->addService('query_config', $app['query.config']);

            return $parser;
        };

        $app['query.parser.handler'] = function ($app) {
            return new QueryParameterParser($app['storage']->createExpressionBuilder());
        };

        $app['query.select'] = function ($app) {
            return new SelectQuery($app['storage']->createQueryBuilder(), $app['query.parser.handler']);
        };

        $app['query.scope.frontend'] = $app->share(<commit_msg>remove this as service<commit_after><?php

namespace Bolt\Provider;

use Bolt\Storage\Query\ContentQueryParser;
use Bolt\Storage\Query\FrontendQueryScope;
use Bolt\Storage\Query\Query;
use Bolt\Storage\Query\QueryParameterParser;
use Bolt\Storage\Query\SearchConfig;
use Bolt\Storage\Query\SearchQuery;
use Bolt\Storage\Query\SearchWeighter;
use Bolt\Storage\Query\SelectQuery;
use Silex\Application;
use Silex\ServiceProviderInterface;

class QueryServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        $app['query'] = function ($app) {
            $runner = new Query($app['query.parser']);
            $runner->addScope('frontend', $app['query.scope.frontend']);

            return $runner;
        };

        $app['query.parser'] = function ($app) {
            $parser = new ContentQueryParser($app['storage']);
            $parser->addService('select', $app['query.select']);
            $parser->addService('search', $app['query.search']);
            $parser->addService('search_weighter', $app['query.search_weighter']);
            $parser->addService('search_config', $app['query.search_config']);

            return $parser;
        };

        $app['query.parser.handler'] = function ($app) {
            return new QueryParameterParser($app['storage']->createExpressionBuilder());
        };

        $app['query.select'] = function ($app) {
            return new SelectQuery($app['storage']->createQueryBuilder(), $app['query.parser.handler']);
        };

        $app['query.scope.frontend'] = $app->share(
{'fraction_non_alphanumeric': 0.15605686032138444, 'fraction_numerical': 0.0, 'mean_word_length': 3.386178861788618, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '5092374', 'n_tokens_mistral': 899, 'n_tokens_neox': 887, 'n_words': 148}