Changes
2 changed files (+6/-4)
-
-
@@ -14,7 +14,7 @@ ## UsageThis program uses a client-server architecture to watch directories with inotify and keep the model in memory so the client doesn't have to wait several seconds to load the model. It uses file inodes and modification times to avoid unnecessary re-indexing. Run `python server.py DIRS_TO_INDEX` to start the server. Make sure that none of the directories contain other directories on that list or weird stuff will happen. The server currently only indexes images although more modalities may be supported in the future. There are probably some weird race condition bugs if you modify a lot of files at the same time. Run `python server.py DIRS_TO_INDEX` to start the server. Make sure you don't include nested directories or weird stuff will happen. The server currently only indexes images although more modalities may be supported in the future. There are probably some weird race condition bugs if you modify a lot of files at the same time. Then run `python client.py SEARCH_TEXT NUM_RESULTS` to get a list of the most similar files. You can pass this list to an image viewer such as Gwenview to view image results, although note that Gwenview doesn't preserve the order of the images. Alternatively, add a third parameter to `python client.py` and it will create a temporary directory containing symlinks to the search results and return the directory name.
-
@@ -22,6 +22,8 @@ Check out [TIDY](https://github.com/slavabarkov/tidy) (for Android) and [rclip](https://github.com/yurijmikhalevich/rclip) for similar projects, although this one is probably fastest!## TODO - Write a `pyproject.toml` and properly package this. - Write a `pyproject.toml` and properly package this - Support OSes other than Linux? It should be fairly portable now other than a few things like `os.environ["XDG_RUNTIME_DIR"]`. - GUI - Investigate race condition bugs and stress test this more - Detect if `DIRS_TO_INDEX` contains nested dirs
-
-
-
@@ -17,7 +17,7 @@DIM = 768 print("Connecting to DB") con = sqlite3.connect("search.db") con = sqlite3.connect("search.db", check_same_thread=False) con.execute("PRAGMA journal_mode=WAL") con.enable_load_extension(True) sqlite_vec.load(con)
-
@@ -127,7 +127,7 @@def unindex(ino): print("Unindexing", ino) res = cur.execute("SELECT id FROM idx WHERE parent = ?", (ino,)) res = cur.execute("SELECT ino FROM idx WHERE parent = ?", (ino,)) for db_child in res.fetchall(): unindex(db_child[0]) cur.execute("DELETE FROM idx WHERE ino = ?", (ino,))
-