Browse Source

clickable link in search results

main
crunk 5 months ago
parent
commit
b6313e2dc4
  1. 3
      verse/search/search.py
  2. 4
      verse/search/templates/search/search.html

3
verse/search/search.py

@ -15,6 +15,7 @@ searchpages = Blueprint(
SCRIPT_DIR = os.path.dirname(__file__) SCRIPT_DIR = os.path.dirname(__file__)
SEARCH_DATA_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "searchdata")) SEARCH_DATA_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "searchdata"))
@searchpages.route("/", methods=["GET", "POST"]) @searchpages.route("/", methods=["GET", "POST"])
def searchpage(): def searchpage():
searchform = SearchForm() searchform = SearchForm()
@ -31,7 +32,7 @@ def searchpage():
def search(searchinput): def search(searchinput):
"""search and get search result titles and return them as distribusi ids""" """search and get search result titles and return them as distribusi ids"""
ix = open_dir(SEARCH_DATA_DIRgi) ix = open_dir(SEARCH_DATA_DIR)
with ix.searcher() as searcher: with ix.searcher() as searcher:
query = QueryParser("content", ix.schema).parse(searchinput) query = QueryParser("content", ix.schema).parse(searchinput)
search_results = searcher.search(query) search_results = searcher.search(query)

4
verse/search/templates/search/search.html

@ -15,8 +15,8 @@
</fieldset> </fieldset>
</form> </form>
<div class="searchresults"> <div class="searchresults">
{% for found_distribusis in found_distribusis %} {% for found_distribusi in found_distribusis %}
<p>{{found_distribusis}}</p> <a href='{{ url_for('shortstashurl')}}/{{found_distribusi}}/index.html'>{{found_distribusi}}</a>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

Loading…
Cancel
Save