<commit_before>#include "SearchManager.h"
#include "SearchFactory.h"
#include <mining-manager/MiningManager.h>
#include <bundles/index/IndexBundleConfiguration.h>

#include <glog/logging.h>

using namespace sf1r;

SearchManager::SearchManager(
    const IndexBundleConfiguration& config,
    const SearchFactory& searchFactory)
    : preprocessor_(config.indexSchema_)
    , topKReranker_(preprocessor_)
    , fuzzySearchRanker_(preprocessor_)
    , queryBuilder_(searchFactory.createQueryBuilder(
                        preprocessor_.getSchemaMap()))
    , searchBase_(searchFactory.createSearchBase(
                      preprocessor_, *queryBuilder_))
{
}

void SearchManager::setMiningManager(
    const boost::shared_ptr<MiningManager>& miningManager)
{
    if (!miningManager)
    {
        LOG(WARNING) << "as MininghManager is uninitialized, "
                     << "some functions in SearchManager would not work!";
        return;
    }

    preprocessor_.setProductScorerFactory(
        miningManager->GetProductScorerFactory());

    preprocessor_.setNumericTableBuilder(
        miningManager->GetNumericTableBuilder());

    searchBase_->setMiningManager(miningManager);

    topKReranker_.setProductRankerFactory(
        miningManager->GetProductRankerFactory());

    fuzzySearchRanker_.setFuzzyScoreWeight(
        miningManager->getMiningSchema().product_ranking_config);
}<commit_msg>in SearchManager::setMiningManager(), adjust the sequence of calling member's functions.<commit_after>#include "SearchManager.h"
#include "SearchFactory.h"
#include <mining-manager/MiningManager.h>
#include <bundles/index/IndexBundleConfiguration.h>

#include <glog/logging.h>

using namespace sf1r;

SearchManager::SearchManager(
    const IndexBundleConfiguration& config,
    const SearchFactory& searchFactory)
    : preprocessor_(config.indexSchema_)
    , topKReranker_(preprocessor_)
    , fuzzySearchRanker_(preprocessor_)
    , queryBuilder_(searchFactory.createQueryBuilder(
                        preprocessor_.getSchemaMap()))
    , searchBase_(searchFactory.createSearchBase(
                      preprocessor_, *queryBuilder_))
{
}

void SearchManager::setMiningManager(
    const boost::shared_ptr<MiningManager>& miningManager)
{
    if (!miningManager)
    {
        LOG(WARNING) << "as MininghManager is uninitialized, "
                     << "some functions in SearchManager would not work!";
        return;
    }

    preprocessor_.setProductScorerFactory(
        miningManager->GetProductScorerFactory());

    preprocessor_.setNumericTableBuilder(
        miningManager->GetNumericTableBuilder());

    topKReranker_.setProductRankerFactory(
        miningManager->GetProductRankerFactory());

    fuzzySearchRanker_.setFuzzyScoreWeight(
        miningManager->getMiningSchema().product_ranking_config);

    searchBase_->setMiningManager(miningManager);
}
{'fraction_non_alphanumeric': 0.09436571033529209, 'fraction_numerical': 0.000691323885240235, 'mean_word_length': 4.041811846689895, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '1359889', 'n_tokens_mistral': 804, 'n_tokens_neox': 765, 'n_words': 122}