mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +00:00
main as user.db, then attach readonly db's
This commit is contained in:
1 parent
d96346bfea
commit
fa5bfb56b0
11 files changed
+526
-435
No files matched your search
@@ -5,13 +5,14 @@ use std::{
|
||||
};
|
||||
|
||||
use anyhow::{Context, Ok};
|
||||
use cjdic2_core::db::Database;
|
||||
use cjdic2_core::AppService;
|
||||
|
||||
mod common;
|
||||
use common::get_db_path;
|
||||
use common::get_db_dir;
|
||||
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let db = Database::new(get_db_path())?;
|
||||
let service = AppService::new(get_db_dir())?;
|
||||
let mut writer = service.get_yomitan_writer()?;
|
||||
|
||||
let zip_dir = Path::new("tmp/yomitan");
|
||||
println!("zip_dir: {:?}", absolute(zip_dir)); // Relative to workspace root
|
||||
@@ -26,7 +27,10 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
let start = Instant::now();
|
||||
|
||||
println!("zip_file: {:?}", p);
|
||||
println!("{:?}", db.yomitan().import_bundled_zip_file(p, "ja")?,);
|
||||
println!(
|
||||
"{:?}",
|
||||
AppService::import_yomitan_zip_file(&mut writer, p, "ja")?,
|
||||
);
|
||||
println!("[{:.2?}]", start.elapsed(),);
|
||||
} else {
|
||||
println!("not zip_file: {:?}", p);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub fn get_db_path() -> PathBuf {
|
||||
PathBuf::from("test.db")
|
||||
pub fn get_db_dir() -> PathBuf {
|
||||
PathBuf::from("tmp/save-db")
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Ok;
|
||||
use cjdic2_core::db::Database;
|
||||
use cjdic2_core::AppService;
|
||||
|
||||
mod common;
|
||||
use common::get_db_path;
|
||||
use common::get_db_dir;
|
||||
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let db = Database::new(get_db_path())?;
|
||||
let service = AppService::new(get_db_dir())?;
|
||||
|
||||
let start = Instant::now();
|
||||
let rs = db.yomitan().search_yomitan("擦る", "する", 10, 0)?;
|
||||
let rs = service.search_yomitan("擦る", "する", 10, 0)?;
|
||||
println!("{:#?}", rs);
|
||||
println!("n={}", rs.len());
|
||||
println!("[{:.2?}]", start.elapsed());
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Ok;
|
||||
use cjdic2_core::db::Database;
|
||||
use cjdic2_core::AppService;
|
||||
|
||||
mod common;
|
||||
use common::get_db_path;
|
||||
use common::get_db_dir;
|
||||
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let db = Database::new(get_db_path())?;
|
||||
let service = AppService::new(get_db_dir())?;
|
||||
|
||||
let start = Instant::now();
|
||||
db.yomitan().create_schema()?;
|
||||
service.get_yomitan_writer()?;
|
||||
println!("[{:.2?}]", start.elapsed());
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user