Esempio n. 1
0
def main(addr, filepath):
    print time.time(), 'import begin.'
    client = indexd.client.Client(addr)
    client.setmode('RDWR')
    print time.time(), 'creating database...'
    client.createdb(name='test_en', conf=config)
    client.setdb('test_en')

    print time.time(), 'start indexing...'
    for d in parse_csv_file(filepath):
        client.insert(d)

    print time.time(), 'indexing finished.'
    client.close()
    print time.time(), 'all done.'
Esempio n. 2
0
def main(addr, filepath):
    print time.time(), 'import begin.'
    client = indexd.client.Client(addr)
    client.setmode('RDWR')
    print time.time(), 'creating database...'
    client.createdb(name='test_comments', conf=config)
    client.setdb('test_comments')

    print time.time(), 'start indexing...'
    for i, d in enumerate(parse_csv_file(filepath)):
        client.insert(d)
        if i % 20000 == 19999:
            client.commit()

    print time.time(), 'indexing finished.'
    client.close()
    print time.time(), 'all done.'