コード例 #1
0
 def similar(self, limit, numterms=40, fieldname='text'):
     "Most similar results to document."
     from skid import index
     ix = index.open_dir(index.DIRECTORY, index.NAME)
     with ix.searcher() as searcher:
         results = searcher.find('cached', unicode(self.cached))
         result = results[0]
         for hit in result.more_like_this(top=limit, numterms=numterms, fieldname=fieldname):
             yield hit
コード例 #2
0
 def similar(self, limit, numterms=40, fieldname='text'):
     "Most similar results to document."
     from skid import index
     ix = index.open_dir(index.DIRECTORY, index.NAME)
     with ix.searcher() as searcher:
         results = searcher.find('cached', str(self.cached))
         result = results[0]
         for hit in result.more_like_this(top=limit,
                                          numterms=numterms,
                                          fieldname=fieldname):
             yield hit
コード例 #3
0
                self.lb.selection_set(first=index)
                self.lb.activate(index)

    def comparison(self):
        q = self.var.get()
        q = unicode(q.decode('utf8'))
        for hit in searcher.search(qp.parse(q), limit=50):
            if hit['author']:
                yield '%s. "%s"' % (hit['author'], hit['title'])
            else:
                yield hit['title']


from skid.index import open_dir, MultifieldParser, DIRECTORY, NAME

ix = open_dir(DIRECTORY, NAME)
searcher = ix.searcher()
qp = MultifieldParser(fieldnames=['title', 'author', 'tags', 'notes', 'text'],
                      fieldboosts={'title': 5,
                                   'author': 5,
                                   'tags': 3,
                                   'notes': 2,
                                   'text': 1},
                      schema=ix.schema)


if __name__ == '__main__':
    root = Tk()

    frame = Frame(master=root, height=200, width=400, bd=1, relief=SUNKEN)
コード例 #4
0
ファイル: tkautocomplete.py プロジェクト: timvieira/skid
                self.lb.selection_set(first=index)
                self.lb.activate(index)

    def comparison(self):
        q = self.var.get()
        q = str(q.decode('utf8'))
        for hit in searcher.search(qp.parse(q), limit=50):
            if hit['author']:
                yield '%s. "%s"' % (hit['author'], hit['title'])
            else:
                yield hit['title']


from skid.index import open_dir, MultifieldParser, DIRECTORY, NAME

ix = open_dir(DIRECTORY, NAME)
searcher = ix.searcher()
qp = MultifieldParser(fieldnames=['title', 'author', 'tags', 'notes', 'text'],
                      fieldboosts={'title': 5,
                                   'author': 5,
                                   'tags': 3,
                                   'notes': 2,
                                   'text': 1},
                      schema=ix.schema)


if __name__ == '__main__':
    root = Tk()

    frame = Frame(master=root, height=200, width=400, bd=1, relief=SUNKEN)