From efc10086cbb6726c3728c8edda93b8fd00436717 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 4 Mar 2024 04:40:50 +0300 Subject: Support ?q=category queries Warning, untested. But hopefully works! --- src/database/file/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/database/file') diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs index 27d3da1..46660ab 100644 --- a/src/database/file/mod.rs +++ b/src/database/file/mod.rs @@ -253,6 +253,20 @@ async fn hydrate_author( #[async_trait] impl Storage for FileStorage { + #[tracing::instrument(skip(self))] + async fn categories(&self, url: &str) -> Result> { + // This requires an expensive scan through the entire + // directory tree. + // + // Until this backend has some kind of caching/indexing for + // categories (consider using symlinks?), this query won't + // perform well. + Err(std::io::Error::new( + std::io::ErrorKind::Unsupported, + "?q=category queries are not implemented due to resource constraints" + ))? + } + #[tracing::instrument(skip(self))] async fn post_exists(&self, url: &str) -> Result { let path = url_to_path(&self.root_dir, url); -- cgit 1.4.1