def search(): """Returns the results page.""" query = util.clean_words(request.args.get("query", "")) if query == "": return render_template("index.html") else: results = moogle.answer(app.db, query) return render_template("search.html", authors=moogle.authors(), query=query, results=results)
def main(): parser = argparse.ArgumentParser( description="Answer module for the µoogle project", epilog=moogle.authors(), ) parser.add_argument("-q", "--query", type=str, help="query (use single quotes for more than one word") parser.add_argument("-d", "--database", type=str, help="filename of the database", default="moogle.dat") args = parser.parse_args(sys.argv[1:]) db = moogle.load(args.database) answer = moogle.answer(db, args.query) pprint.pprint(answer)