<commit_before><?php

namespace Bolt\Provider;

use Bolt\Storage\Query\ContentQueryParser;
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']);

            return $runner;
        };

        $app['query.parser'] = $app->share(
            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']);

                return $parser;
            }
        );

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

        $app['query.select'] = $app->share(
            function ($app) {
                return new SelectQuery($app['storage']->createQueryBuilder(), $app['query.parser.handler']);
            }
        );
        
        $app['query.search'] = $app->share(
            function ($app) {
                return new SearchQuery($app['storage']->createQueryBuilder(), $app['query.parser.handler'], $app['query.search_config']);
            }
        );
        
        $app['query.search_config'] = $app->share(
            function ($app) {
                return new SearchConfig($app['config']);
            }
        );<commit_msg>add a search config service to the provider<commit_after><?php

namespace Bolt\Provider;

use Bolt\Storage\Query\ContentQueryParser;
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']);

            return $runner;
        };

        $app['query.parser'] = $app->share(
            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'] = $app->share(
            function ($app) {
                return new QueryParameterParser($app['storage']->createExpressionBuilder());
            }
        );

        $app['query.select'] = $app->share(
            function ($app) {
                return new SelectQuery($app['storage']->createQueryBuilder(), $app['query.parser.handler']);
            }
        );
        
        $app['query.search'] = $app->share(
            function ($app) {
                return new SearchQuery($app['storage']->createQueryBuilder(), $app['query.parser.handler'], $app['query.search_config']);
            }
        );
        
        $app['query.search_config'] = $app->share(
            function ($app) {
                return new SearchConfig($app['config']);
            }
        );
{'fraction_non_alphanumeric': 0.14952551936393949, 'fraction_numerical': 0.0, 'mean_word_length': 2.299492385786802, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '7043046', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1020, 'n_words': 175}