修复搜索框内查询
This commit is contained in:
parent
596bead678
commit
16faed70ce
17
web/main.py
17
web/main.py
@ -6,7 +6,8 @@ from ml.Search import Search
|
|||||||
render = web.template.render('templates/')
|
render = web.template.render('templates/')
|
||||||
|
|
||||||
urls=(
|
urls=(
|
||||||
'/(.*)','index'
|
"/","index",
|
||||||
|
"/news","news"
|
||||||
)
|
)
|
||||||
|
|
||||||
app = web.application(urls,globals())
|
app = web.application(urls,globals())
|
||||||
@ -14,17 +15,23 @@ app = web.application(urls,globals())
|
|||||||
class index:
|
class index:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.se = Search()
|
self.se = Search()
|
||||||
def GET(self,searchword):
|
def GET(self):
|
||||||
|
searchword = web.input().searchword
|
||||||
newslist=list()
|
newslist=list()
|
||||||
if searchword:
|
if searchword:
|
||||||
newslist = self.se.QueryPhrase(searchword,False)
|
newslist = self.se.QueryPhrase(searchword,False)
|
||||||
return render.header(searchword,newslist)
|
return render.header(searchword,newslist)
|
||||||
def POST(self):
|
|
||||||
searchword = web.input(searchword=[])
|
class news:
|
||||||
|
def __init__(self):
|
||||||
|
self.se = Search()
|
||||||
|
def GET(self):
|
||||||
|
searchword = web.input().searchword
|
||||||
|
newslist=list()
|
||||||
if searchword:
|
if searchword:
|
||||||
newslist = self.se.QueryPhrase(searchword,False)
|
newslist = self.se.QueryPhrase(searchword,False)
|
||||||
return render.header(searchword,newslist)
|
return render.header(searchword,newslist)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = web.application(urls,globals())
|
app = web.application(urls,globals())
|
||||||
app.run()
|
app.run()
|
||||||
|
BIN
web/main.pyc
BIN
web/main.pyc
Binary file not shown.
@ -13,11 +13,9 @@ $def with(searchword,newslist)
|
|||||||
<form class="bs-example bs-example-form" role="form">
|
<form class="bs-example bs-example-form" role="form">
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="searchword" class="form-control" placeholder=$searchword>
|
<input type="text" class="form-control" name="searchword" placeholder=$searchword>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button type="submit" class="btn btn-default" type="button">
|
<button class="btn btn-default" type="button">搜索</button>
|
||||||
搜索
|
|
||||||
</button>
|
|
||||||
</span>
|
</span>
|
||||||
</div><!-- /input-group -->
|
</div><!-- /input-group -->
|
||||||
</div><!-- /.col-lg-6 -->
|
</div><!-- /.col-lg-6 -->
|
||||||
|
Loading…
Reference in New Issue
Block a user