Esempio n. 1
0
def print_depth_statistic(index):
    html.div('<b>depth statistic</b>')
    print """<table>
    <tr><td>depth</td><td>pages</td></tr>"""
    for s in index.get_depth_stat():
        print '<tr><td>%i</td><td>%i</td></tr>' % s
    print '</table>'
Esempio n. 2
0
def print_common_statistic(index):
    index_cnt, page_cnt, dome_cnt = index.len()
    html.div('<b>common statistic</b>')
    html.div('%i words in index', index_cnt)
    html.div('%i pages indexed', page_cnt)
    html.div('%i domains indexed', dome_cnt)
    html.br()
   
    html.div('<b>most common words</b>')
    print '<table border=0>'
    print '<tr><td>word</td><td>count</td></tr>'
    for key, n in index.most_common(15):
        print '<tr><td>%s</td><td>%i</td></tr>' % (key, n)
    print '</table>'
Esempio n. 3
0
html.header()

query = form.getvalue('q')
if not query:
    query = ''    

print """
<div/>
    <a href="index.py"><b>search</b></a>&nbsp;&nbsp;&nbsp;
    <a href="statistic.py">statistic</a>&nbsp;&nbsp;&nbsp;
    <a href="web.py">web model</a>
<div><br/>
<form method="post">
<input name="q" value="%s">
<input name="s" type="submit" value="search">
</form>
""" % query

try:
    index = IndexManager.get_proxy()
    if query:
        for url in index.lookup(query):
            print '<div>'
            html.a(url, url)
            print '</div>' 
except socket.error:
    html.div("can't connect to DataStorage")

html.footer()
Esempio n. 4
0
def print_domains(index):
    html.div('<b>domains</b>')
    for h in index.hosts():
        print '<div>'
        html.a('http://'+h, h)
        print '</div>'