Chunking
This commit is contained in:
1 parent
f54aaa6e95
commit
f5197caa77
7 files changed
+259
-69
No files matched your search
+2
-7
@@ -44,7 +44,6 @@ data Options
|
||||
| Version
|
||||
| Index
|
||||
{ verbose :: Bool,
|
||||
credentials :: FilePath <?> "Path to the credentials.json",
|
||||
rebuild :: Bool <?> "Rebuild index from scratch" <!> "False",
|
||||
embeddingsDb :: Maybe FilePath <?> "Path to embeddings database"
|
||||
}
|
||||
@@ -203,10 +202,6 @@ runWithDb mbDb sev f = initialS Nothing sev $ \s -> runM s $ do
|
||||
liftIO $ createDirectoryIfMissing True (takeDirectory dbPath)
|
||||
f dbPath
|
||||
|
||||
printResult :: Int -> Text -> Double -> Text
|
||||
printResult n url score =
|
||||
T.pack $ printf "%3d. %s (score: %.4f)" n (T.unpack url) score
|
||||
|
||||
defaultMain :: IO ()
|
||||
defaultMain = do
|
||||
opts <- getRecord "Wallabag tagger"
|
||||
@@ -214,13 +209,13 @@ defaultMain = do
|
||||
Quick {verbose} -> run (severity verbose) Unarchived
|
||||
Full {verbose} -> run (severity verbose) Everything
|
||||
Version -> print Version.compileTimeVersion
|
||||
Index {verbose, credentials, rebuild, embeddingsDb} ->
|
||||
Index {verbose, rebuild, embeddingsDb} ->
|
||||
runWithDb (unHelpful embeddingsDb) (severity verbose) $ \db ->
|
||||
indexEntries db (unHelpful $ unDefValue rebuild)
|
||||
Search {verbose, query, limit, embeddingsDb} ->
|
||||
runWithDb (unHelpful embeddingsDb) (severity verbose) $ \db -> do
|
||||
entries <- search db (unHelpful query) (unHelpful $ unDefValue limit)
|
||||
liftIO $ mapM_ (\(score, _eid, url, _title) -> T.putStrLn $ T.pack $ printf "%.4f %s" (score :: Double) (T.unpack url)) entries
|
||||
liftIO $ mapM_ (\(score, _eid, u, _title) -> T.putStrLn $ T.pack $ printf "%.4f %s" (score :: Double) (T.unpack u)) entries
|
||||
Daemon {verbose, credentials, port, embeddingsDb} ->
|
||||
runDaemon (unHelpful $ unDefValue port) (unHelpful credentials) (severity verbose)
|
||||
where
|
||||
|
||||
Reference in new issue
Block a user