mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-12-14 07:39:05 +00:00
Search by path
This commit is contained in:
13
run.py
13
run.py
@@ -8,7 +8,6 @@ import humanfriendly
|
||||
from search import Search
|
||||
from PIL import Image
|
||||
from io import BytesIO
|
||||
from collections import defaultdict
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = "A very secret key"
|
||||
@@ -18,8 +17,6 @@ tm = TaskManager(storage)
|
||||
search = Search("changeme")
|
||||
|
||||
|
||||
|
||||
|
||||
def get_dir_size(path):
|
||||
|
||||
size = 0
|
||||
@@ -33,6 +30,12 @@ def get_dir_size(path):
|
||||
return size
|
||||
|
||||
|
||||
@app.route("/suggest")
|
||||
def suggest():
|
||||
|
||||
return json.dumps(search.suggest(request.args.get("prefix")))
|
||||
|
||||
|
||||
@app.route("/document/<doc_id>")
|
||||
def document(doc_id):
|
||||
|
||||
@@ -116,8 +119,10 @@ def search_route():
|
||||
size_max = request.json["size_max"]
|
||||
mime_types = request.json["mime_types"]
|
||||
must_match = request.json["must_match"]
|
||||
directories = request.json["directories"] # todo: make sure dir exists and is enabled
|
||||
path = request.json["path"]
|
||||
|
||||
page = search.search(query, size_min, size_max, mime_types, must_match)
|
||||
page = search.search(query, size_min, size_max, mime_types, must_match, directories, path)
|
||||
|
||||
return json.dumps(page)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user