Example #1
0
        return ndoc
    
    '''
    used default _date field to generate the file path where the doc is stored
    '''
    def gen_path(self, doc):
        if not doc.has_key('_date'):
            doc['_date'] = datetime.now(tz.tzlocal())
        dt = doc['_date']
        return os.path.sep.join([self.dir, str(dt.year), str(dt.month), \
            str(dt.day) + '.sen'])

if __name__ == '__main__':
    defi = DefinitionIndexer('/data/personalSite/app/web/static/definition')
    defs = Searcher(defi)
    with defs.open() as searcher:
        r = defs.search(searcher, 'content', u'developing')
        found = r.scored_length()
        print found
        for rr in r:
            print rr['id']
    '''
    si = SenIndexer('sen')
    di = DocIndexer('doc')
    ss = Searcher(si)
    ds = Searcher(di)

    di.doc_op({
        'content': u'doc',
        'tags': [u't'],
        'categories': [],