File: thApiTest.py

package info (click to toggle)
thawab 4.1-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye, sid
  • size: 1,912 kB
  • sloc: python: 4,041; makefile: 134; sh: 33
file content (27 lines) | stat: -rwxr-xr-x 924 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import os, os.path, Thawab.core
th=Thawab.core.ThawabMan()
th.searchEngine.reindexAll()
# th.loadMeta() # to detect new files and add them ..etc.
meta=th.getMeta()
print(meta.getUriList())
th.searchEngine.reindexKitab('/home/alsadi/.thawab/db/uthaymine.ki')

## export to xml
#from cStringIO import StringIO
#s=StringIO()
#ki=Thawab.core.Kitab('/home/alsadi/.thawab/tmp/THAWAB_xqkca0.ki3001')
#n=ki.root.toXml(s)
#print s.getvalue()

## export to HTML or wiki
#import Thawab.core
#ki=Thawab.core.Kitab('/home/alsadi/.thawab/tmp/THAWAB_xqkca0.ki3001')
#s=ki.root.toHTML()
#print s

##searching the index
#for i in th.searchEngine.queryIndex('إنشاء'.decode('utf-8')): print i['title']
#for i in th.searchEngine.queryIndex('إنشاء kitab:pyqt4'.decode('utf-8')): print i['title']
#for i in th.searchEngine.queryIndex('إنشاء kitab:test'.decode('utf-8')): print i['title']