aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2024-07-27 16:12:32 +0000
committerAnthony Wang2024-07-27 16:12:32 +0000
commitcd5f01368954d1e1295f9b4f477d9d586e6903b0 (patch)
tree7beab8bf6f5ece97e2b38bf03e0c742c7299f1b7
parentdb8abe2af3f827b5f78fd1f674d334385b15e3e3 (diff)
Print out search queries, skip hidden files
-rw-r--r--server.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/server.py b/server.py
index d993a30..ac8ea15 100644
--- a/server.py
+++ b/server.py
@@ -59,6 +59,10 @@ class EventHandler(FileSystemEventHandler):
def index(path, parent):
+ if os.path.basename(path).startswith("."):
+ # Skip hidden files
+ return
+
print("Indexing", path, parent)
s = os.stat(path)
if os.path.isfile(path):
@@ -133,6 +137,7 @@ def unindex(id):
def search(text, limit):
+ print("Search", text, limit)
emb = model.embed_text(text).cpu().numpy()
res = cur.execute(
"SELECT idx.path FROM emb LEFT JOIN idx ON emb.id = idx.id WHERE embedding MATCH ? AND k = ? ORDER BY distance",