<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <defaults public="true" />

        <service id="shopware_search.product_number_search" class="Shopware\Bundle\SearchBundleDBAL\ProductNumberSearch">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory"/>
            <argument type="service" id="Shopware\Components\ContainerAwareEventManager" />
            <argument type="tagged" tag="facet_handler_dbal" />
            <argument type="service" id="service_container" />
        </service>

        <service id="shopware_searchdbal.search_price_helper_dbal" class="Shopware\Bundle\SearchBundleDBAL\PriceHelper">
            <argument type="service" id="Shopware_Components_Config" />
        </service>

        <service id="shopware_searchdbal.listing_price_table" class="Shopware\Bundle\SearchBundleDBAL\ListingPriceTable">
            <argument type="service" id="Doctrine\DBAL\Connection" />
            <argument type="service" id="Shopware_Components_Config" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\ListingPriceHelper"/>
        </service>

        <!-- Search handlers -->
        <service id="shopware_searchdbal.search_query_builder_dbal" class="Shopware\Bundle\SearchBundleDBAL\SearchTerm\SearchTermQueryBuilder">
            <argument type="service" id="Shopware_Components_Config" />
            <argument type="service" id="Doctrine\DBAL\Connection" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\SearchTerm\CacheKeywordFinder" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\SearchTerm\SearchIndexer" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\SearchTerm\TermHelperInterface" />
        </service>

        <service id="shopware_searchdbal.cache_keyword_finder" class="Shopware\Bundle\SearchBundleDBAL\SearchTerm\CacheKeywordFinder">
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Service\Core\CoreCache" />
            <argument type="service" id="Shopware_Components_Config" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\SearchTerm\KeywordFinder" />
        </service>

        <service id="shopware_searchdbal.keyword_finder_dbal" class="Shopware\Bundle\SearchBundleDBAL\SearchTerm\KeywordFinder">
            <argument type="service" id="Shopware_Components_Config" />
            <argument type="service" id="Doctrine\DBAL\Connection" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\SearchTerm\TermHelperInterface" />
        </service>

        <service id="shopware_searchdbal.search_indexer" class="Shopware\Bundle\SearchBundleDBAL\SearchTerm\SearchIndexer">
            <argument type="service" id="Shopware_Components_Config" />
            <argument type="service" id="Doctrine\DBAL\Connection" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\SearchTerm\TermHelperInterface" />
            <argument>%shopware.search.indexer.batchsize%</argument>
        </service>

        <service id="shopware_searchdbal.search_term_helper" class="Shopware\Bundle\SearchBundleDBAL\SearchTerm\TermHelper">
            <argument type="service" id="Shopware_Components_Config" />
        </service>

        <service id="shopware_searchdbal.search_term_logger" class="Shopware\Bundle\SearchBundleDBAL\SearchTerm\SearchTermLogger">
            <argument type="service" id="Doctrine\DBAL\Connection" />
        </service>

        <!-- Facet handler -->
        <service id="shopware_searchdbal.vote_average_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\VoteAverageFacetHandler">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <argument type="service" id="Shopware_Components_Snippet_Manager" />
            <argument type="service" id="Shopware\Components\QueryAliasMapper" />
            <argument type="service" id="Shopware_Components_Config" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.shipping_free_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\ShippingFreeFacetHandler">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <argument type="service" id="Shopware_Components_Snippet_Manager" />
            <argument type="service" id="Shopware\Components\QueryAliasMapper" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.product_attribute_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\ProductAttributeFacetHandler">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <argument type="service" id="Shopware\Bundle\AttributeBundle\Service\CrudService" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.immediate_delivery_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\ImmediateDeliveryFacetHandler">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <argument type="service" id="Shopware_Components_Snippet_Manager" />
            <argument type="service" id="Shopware\Components\QueryAliasMapper" />
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.manufacturer_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\ManufacturerFacetHandler">
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Service\ManufacturerServiceInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <argument type="service" id="Shopware_Components_Snippet_Manager" />
            <argument type="service" id="Shopware\Components\QueryAliasMapper" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.property_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\PropertyFacetHandler">
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Gateway\PropertyGatewayInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <argument type="service" id="Shopware\Components\QueryAliasMapper" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.category_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\CategoryFacetHandler">
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Service\CategoryServiceInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <argument type="service" id="shopware_storefront.category_depth_service" />
            <argument type="service" id="shopware_search.category_tree_facet_result_builder" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.price_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\PriceFacetHandler">
            <tag name="facet_handler_dbal"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory"/>
            <argument type="service" id="Shopware_Components_Snippet_Manager"/>
            <argument type="service" id="Shopware\Components\QueryAliasMapper"/>
            <argument type="service" id="shopware_searchdbal.listing_price_switcher"/>
        </service>

        <service class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\VariantFacetHandler" id="shopware_bundle.search_bundle_dbal_facet_handler.variant_facet_handler">
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Gateway\ConfiguratorOptionsGatewayInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory"/>
            <argument type="service" id="Shopware\Components\QueryAliasMapper"/>
            <argument type="service" id="shopware_searchdbal.search_price_helper_dbal"/>
            <tag name="facet_handler_dbal"/>
        </service>

        <!-- Condition handler -->
        <service id="shopware_searchdbal.vote_average_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\VoteAverageConditionHandler">
            <argument type="service" id="Shopware_Components_Config" />
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.is_available_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\IsAvailableConditionHandler">
            <argument type="service" id="shopware_searchdbal.search_price_helper_dbal" />
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.closeout_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\CloseoutConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.has_pseudo_price_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\HasPseudoPriceConditionHandler">
            <argument type="service" id="shopware_searchdbal.listing_price_switcher"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\ListingPriceHelper"/>
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.is_new_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\IsNewConditionHandler">
            <argument type="service" id="Shopware_Components_Config" />
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.release_date_condition_handler" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\ReleaseDateConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.create_date_condition_handler" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\CreateDateConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>


        <service id="shopware_searchdbal.search_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\SearchTermConditionHandler">
            <argument type="service" id="shopware_searchdbal.search_query_builder_dbal" />
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.category_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\CategoryConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.ordernumber_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\OrdernumberConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.productid_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\ProductIdConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.product_attribute_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\ProductAttributeConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.customer_group_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\CustomerGroupConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.immediate_delivery_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\ImmediateDeliveryConditionHandler">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface" />
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.manufacturer_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\ManufacturerConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.property_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\PropertyConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.shipping_free_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\ShippingFreeConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.sales_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\SalesConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.price_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\PriceConditionHandler" >
            <argument type="service" id="shopware_searchdbal.listing_price_switcher" />
            <tag name="condition_handler_dbal" />
        </service>

        <service id="shopware_searchdbal.similar_products_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\SimilarProductConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.last_id_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\LastProductIdConditionHandler">
            <tag name="condition_handler_dbal"/>
        </service>

        <!-- Sorting handler -->
        <service id="shopware_searchdbal.product_name_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\ProductNameSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.product_number_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\ProductNumberSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.popularity_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\PopularitySortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.shopware_searchdbal.product_attribute_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\ProductAttributeSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.release_date_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\ReleaseDateSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.price_sorting_handler_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\PriceSortingHandler" >
            <argument type="service" id="shopware_searchdbal.listing_price_switcher" />
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.search_ranking_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\SearchRankingSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.random_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\RandomSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.product_stock_sorting_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\ProductStockSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.manual_sorting_handler" class="Shopware\Bundle\SearchBundleDBAL\SortingHandler\ManualSortingHandler">
            <tag name="sorting_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.combined_condition_facet_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\CombinedConditionFacetHandler">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory" />
            <tag name="facet_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.combined_condition_handler_dbal" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\CombinedConditionHandler">
            <argument type="service" id="service_container" />

            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.dbal_query_builder_factory" class="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory">
            <argument type="service" id="Doctrine\DBAL\Connection" />
            <argument type="service" id="Shopware\Components\ContainerAwareEventManager" />

            <!--condition handlers-->
            <argument type="tagged" tag="condition_handler_dbal" />

            <!--sorting handlers-->
            <argument type="tagged" tag="sorting_handler_dbal" />

            <argument type="service" id="service_container" />
        </service>

        <service id="shopware_searchdbal.product_dimensions_facet_handler" class="Shopware\Bundle\SearchBundleDBAL\FacetHandler\ProductDimensionsFacetHandler" >
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface"/>
            <tag name="facet_handler_dbal"/>
        </service>

        <service class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\VariantConditionHandler" id="shopware_bundle.search_bundle_dbal_condition_handler.variant_condition_handler">
            <tag name="condition_handler_dbal"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface"/>
            <argument type="service" id="Shopware_Components_Config" />
        </service>

        <service id="shopware_searchdbal.height_condition_handler" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\HeightConditionHandler" >
            <argument id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface" type="service"/>
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.length_condition_handler" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\LengthConditionHandler" >
            <argument id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface" type="service"/>
            <tag name="condition_handler_dbal"/>
        </service>


        <service id="shopware_searchdbal.width_condition_handler" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\WidthConditionHandler" >
            <argument id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface" type="service"/>
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.weight_condition_handler" class="Shopware\Bundle\SearchBundleDBAL\ConditionHandler\WeightConditionHandler" >
            <argument id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface" type="service"/>
            <tag name="condition_handler_dbal"/>
        </service>

        <service id="shopware_searchdbal.condition_handlers" class="Doctrine\Common\Collections\ArrayCollection" synthetic="true" />
        <service id="shopware_searchdbal.sorting_handlers" class="Doctrine\Common\Collections\ArrayCollection" synthetic="true" />
        <service id="shopware_searchdbal.facet_handlers" class="Doctrine\Common\Collections\ArrayCollection" synthetic="true" />
        <service id="shopware_searchdbal.variant_helper" class="Shopware\Bundle\SearchBundleDBAL\VariantHelper" >
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Gateway\DBAL\Hydrator\CustomListingHydrator"/>
            <argument type="service" id="Shopware\Bundle\StoreFrontBundle\Gateway\DBAL\FieldHelper"/>
            <argument type="service" id="Shopware_Components_Config"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\ListingPriceHelper"/>
        </service>

        <service id="shopware_searchdbal.listing_price_switcher" class="Shopware\Bundle\SearchBundleDBAL\ListingPriceSwitcher">
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\ListingPriceTableInterface"/>
            <argument type="service" id="Shopware\Bundle\SearchBundleDBAL\VariantHelperInterface"/>
        </service>

        <service id="shopware_searchdbal.listing_price_helper" class="Shopware\Bundle\SearchBundleDBAL\ListingPriceHelper">
            <argument type="service" id="Doctrine\DBAL\Connection"/>
            <argument type="service" id="Shopware_Components_Config"/>
        </service>

    </services>
</container>
