From f48d68df7d81d7b26b030685888267f8aa2886a7 Mon Sep 17 00:00:00 2001 From: Yoonchae Lee Date: Wed, 5 Jun 2024 00:19:32 +0900 Subject: [PATCH] fix: search uses temp pos and reading is filled in --- rust/src/search.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rust/src/search.rs b/rust/src/search.rs index dca8b6fd..d30fdf02 100644 --- a/rust/src/search.rs +++ b/rust/src/search.rs @@ -32,8 +32,14 @@ impl SharedBackend { let entries = self.dictionary.search(&normalized_term)?; if let Some(entry) = entries.get(0) { let form = entry.main_form(); - // TODO: fill pos of details - let details = TokenDetails::default_with_surface(&form); + // TODO: convert jmdict pos to unidic pos + let mut details = TokenDetails::default_with_surface(&form); + details.pos = "jmdict".into(); + details.reading = entry + .reading_for_form(&form) + .map(|r| r.reading.as_str()) + .unwrap_or("*") + .into(); let token = Token::new(form, details, 0); let json_entries = entries .iter()