config_file = sys.argv[1]
    config = yaml.load(file(config_file, 'r'))

    # logging
    logging.config.dictConfig(config['logging'])
    logger = logging.getLogger()

    # MongoDB
    mcm = mongo_from_config(config['mongo'])
    database = config['mongo']['databases']['processed']
    story_collection = mcm.get_collection(database, 'stories', Story)
    topic_collection = mcm.get_collection(database, 'topics', Topic)
    snapshot_collection = mcm.get_collection(database, 'topic_snapshots', TopicSnapshot)

    # elasticsearch
    es = elasticsearch_from_config(config['elasticsearch'])
    main_index = config['elasticsearch']['indexes']['main']

    # helpers
    index_helper = IndexHelper(es)

    # query builder
    max_clauses = config['model_management']['similarity']['max_clauses']
    max_entity_clauses = config['model_management']['similarity']['max_entity_clauses']
    entity_boost = config['model_management']['similarity']['entity_boost']
    term_boost = config['model_management']['similarity']['term_boost']
    query_builder = ModelQueryBuilder(max_clauses, max_entity_clauses, entity_boost, term_boost)

    # settings
    min_similarity = config['model_management']['topic_building']['min_similarity']
Beispiel #2
0
from django.conf import settings
from topic_tracking.util.from_config import elasticsearch_from_config


_es = elasticsearch_from_config(settings.CONFIG['elasticsearch'])
_main_index = settings.CONFIG['elasticsearch']['indexes']['main']


def get_es():
    return _es

def get_es_main_index():
    return _main_index