Expose search writer

This commit is contained in:
RumovZ 2020-12-22 11:06:55 +01:00
parent fcc87d16ea
commit 5b24d9e4a6
3 changed files with 8 additions and 1 deletions

View file

@ -84,6 +84,7 @@ service BackendService {
// searching // searching
rpc NormSearch (String) returns (String);
rpc SearchCards (SearchCardsIn) returns (SearchCardsOut); rpc SearchCards (SearchCardsIn) returns (SearchCardsOut);
rpc SearchNotes (SearchNotesIn) returns (SearchNotesOut); rpc SearchNotes (SearchNotesIn) returns (SearchNotesOut);
rpc FindAndReplace (FindAndReplaceIn) returns (UInt32); rpc FindAndReplace (FindAndReplaceIn) returns (UInt32);

View file

@ -32,7 +32,7 @@ use crate::{
}, },
sched::cutoff::local_minutes_west_for_stamp, sched::cutoff::local_minutes_west_for_stamp,
sched::timespan::{answer_button_time, time_span}, sched::timespan::{answer_button_time, time_span},
search::SortMode, search::{SortMode, norm_search},
stats::studied_today, stats::studied_today,
sync::{ sync::{
get_remote_sync_meta, sync_abort, sync_login, FullSyncProgress, NormalSyncProgress, get_remote_sync_meta, sync_abort, sync_login, FullSyncProgress, NormalSyncProgress,
@ -393,6 +393,10 @@ impl BackendService for Backend {
// searching // searching
//----------------------------------------------- //-----------------------------------------------
fn norm_search(&self, input: pb::String) -> Result<pb::String> {
Ok(norm_search(&input.val)?.into())
}
fn search_cards(&self, input: pb::SearchCardsIn) -> Result<pb::SearchCardsOut> { fn search_cards(&self, input: pb::SearchCardsIn) -> Result<pb::SearchCardsOut> {
self.with_col(|col| { self.with_col(|col| {
let order = if let Some(order) = input.order { let order = if let Some(order) = input.order {

View file

@ -1,6 +1,8 @@
mod cards; mod cards;
mod notes; mod notes;
mod parser; mod parser;
mod writer;
mod sqlwriter; mod sqlwriter;
pub use cards::SortMode; pub use cards::SortMode;
pub use writer::norm_search;