def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'c:p:h', ['config=', 'port=', 'help']) except getopt.GetoptError: usage(); sys.exit(2) config_path = '' options = dict(server_port=8000, max_items=10000) for o, a in opts: if o in ('-c', '--config'): config_path = a elif o in ('-p', '--port'): options['server_port'] = int(a) elif o in ('-h', '--help'): usage(); sys.exit() if config_path: cf = utils.parse_config_file(config_path, **options) else: cf = utils._O(options) if len(args) < 1: usage() else: run_server(args[0], cf)
def make_index(config_path, **opts): opts = utils.parse_config_file(config_path, **opts) index = simsearch.FileIndex(opts.index_path, mode=opts.mode) iter_feat = simsearch.BagOfWordsIter(opts.db_params, opts.sql_features, opts.get("limit", 0)) simsearch.Indexer(index, iter_feat).index_data()
def make_index(config_path, index_name, **options): cf = utils.parse_config_file(config_path, **options) indexer = bsets.Indexer(cf) indexer.index_dataset(cf.get('limit')) indexer.save_index(index_name)
def make_index(config_path, **opts): opts = utils.parse_config_file(config_path, **opts) index = simsearch.FileIndex(opts.index_path, mode=opts.mode) iter_feat = simsearch.BagOfWordsIter(opts.db_params, opts.sql_features, opts.get('limit', 0)) simsearch.Indexer(index, iter_feat).index_data()