diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3050f19 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/Common"] + path = src/Common + url = https://github.com/towards-a-new-leftypol/chandlr-common.git diff --git a/backfill.sh b/backfill.sh index f3e2516..e38e497 100755 --- a/backfill.sh +++ b/backfill.sh @@ -23,7 +23,7 @@ if [[ ! -f "$SETTINGS_FILE" ]]; then exit 1 fi -PROG="./dist-newstyle/build/x86_64-linux/ghc-9.2.8/chan-delorean-0.0.1/x/chan-delorean/build/chan-delorean/chan-delorean" +PROG="./dist-newstyle/build/x86_64-linux/ghc-9.4.8/chan-delorean-0.0.1/x/chan-delorean/build/chan-delorean/chan-delorean" # Ensure chan-delorean is compiled and available if ! command -v $PROG >/dev/null; then @@ -37,7 +37,7 @@ while IFS= read -r BACKUP_PATH; do sed -e 's|\("backup_read_root": \)".*"|\1"'"$BACKUP_PATH"'"|' "$SETTINGS_FILE" > "temp_$SETTINGS_FILE" # Run the Haskell program with the updated settings file - time $PROG +RTS -N2 -RTS "temp_$SETTINGS_FILE" + time $PROG +RTS -N2 -RTS -j "temp_$SETTINGS_FILE" done < "$PATHS_FILE" # Optionally, remove the temporary settings file diff --git a/chan-delorean.cabal b/chan-delorean.cabal index b1cae0b..5c3226a 100644 --- a/chan-delorean.cabal +++ b/chan-delorean.cabal @@ -80,7 +80,7 @@ executable chan-delorean -- other-extensions: -- Other library packages from which modules are imported. - build-depends: base ^>=4.16.4.0, + build-depends: base, aeson, bytestring, cmdargs, diff --git a/sql/archive_tests.sql b/sql/archive_tests.sql index 7a9f471..21a9d99 100644 --- a/sql/archive_tests.sql +++ b/sql/archive_tests.sql @@ -588,7 +588,7 @@ grouped AS ( $$; -SELECT * FROM posts WHERE body_search_index @@ websearch_to_tsquery('english', 'holocaust'); +SELECT * FROM posts WHERE body_search_index @@ websearch_to_tsquery('english', 'portfolios of color'); WITH query AS ( @@ -609,10 +609,20 @@ WHERE p.body_search_index @@ websearch_to_tsquery('english', search_text) ORDER BY ts_rank(p.body_search_index, websearch_to_tsquery('english', search_text)) DESC; $$ LANGUAGE sql STABLE; -SELECT * FROM search_posts('found this board lainchan'); + +SELECT * FROM search_posts('alt chans') s +JOIN threads ON threads.thread_id = s.thread_id +JOIN boards ON boards.board_id = threads.board_id; + SELECT * FROM information_schema.role_routine_grants; +SELECT * FROM posts WHERE board_post_id = 558; +SELECT * FROM posts WHERE thread_id = 12790 ORDER BY board_post_id ASC; -- last post: 2023-10-30 14:20:07.000 -0400 +SELECT * FROM posts JOIN threads ON posts.thread_id = threads.thread_id JOIN boards on boards.board_id = threads.board_id +WHERE board_post_id = 555 +AND pathpart = 'posad' +ORDER BY board_post_id ASC; SELECT to_tsvector('english', body) FROM posts WHERE board_post_id = 476524; diff --git a/sql/archive_tests2.sql b/sql/archive_tests2.sql index ca37dc0..7a48bbf 100644 --- a/sql/archive_tests2.sql +++ b/sql/archive_tests2.sql @@ -197,7 +197,7 @@ $$ LANGUAGE sql; SELECT * FROM fetch_catalog(NOW() - INTERVAL '1y', 1001); -SELECT * FROM fetch_catalog(NOW(), 1000); +SELECT * FROM fetch_catalog(NOW(), 5000); SELECT count(*) FROM posts; diff --git a/src/Backfill.hs b/src/Backfill.hs index 5c41f08..95af6cc 100644 --- a/src/Backfill.hs +++ b/src/Backfill.hs @@ -29,11 +29,6 @@ newtype SettingsCLI = SettingsCLI { jsonFile :: FilePath } deriving (Show, Data, Typeable) -settingsCLI :: SettingsCLI -settingsCLI = SettingsCLI - { jsonFile = def &= args &= typ "settings-jsonfile-path" - } &= summary "Backfill v0.0.2" - listCatalogDirectories :: JSONSettings -> IO [ FilePath ] listCatalogDirectories settings = do @@ -302,7 +297,7 @@ processBackupDirectory settings = do main :: IO () main = do - settingsValue <- cmdArgs settingsCLI + settingsValue <- cmdArgs $ SettingsCLI "backfill_settings.json" let filePath = jsonFile settingsValue if null filePath then do diff --git a/src/Common b/src/Common new file mode 160000 index 0000000..0026e48 --- /dev/null +++ b/src/Common @@ -0,0 +1 @@ +Subproject commit 0026e48cea06e2768f7a22f4a25bf115debcea35 diff --git a/src/PostsType.hs b/src/PostsType.hs deleted file mode 100644 index 2a94cda..0000000 --- a/src/PostsType.hs +++ /dev/null @@ -1,22 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} - -module PostsType - ( Post (..) ) - where - -import GHC.Generics -import Data.Aeson (FromJSON, ToJSON) -import Data.Time.Clock (UTCTime) -- Required for timestamp with time zone -import Data.Int (Int64) -import Data.Text (Text) - -data Post = Post - { post_id :: Maybe Int64 - , board_post_id :: Int64 - , creation_time :: UTCTime - , body :: Maybe Text - , name :: Maybe Text - , subject :: Maybe Text - , email :: Maybe Text - , thread_id :: Int - } deriving (Show, Generic, FromJSON, ToJSON)