Suppress clippy
This commit is contained in:
parent
16624fd742
commit
a733ece26e
@ -21,13 +21,13 @@ impl Actor for SearchActor {
|
|||||||
type Msg = PostEvent;
|
type Msg = PostEvent;
|
||||||
|
|
||||||
fn pre_start(&mut self, ctx: &Context<Self::Msg>) {
|
fn pre_start(&mut self, ctx: &Context<Self::Msg>) {
|
||||||
&POST_CHAN.tell(
|
POST_CHAN.tell(
|
||||||
Subscribe {
|
Subscribe {
|
||||||
actor: Box::new(ctx.myself()),
|
actor: Box::new(ctx.myself()),
|
||||||
topic: "*".into(),
|
topic: "*".into(),
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recv(&mut self, _ctx: &Context<Self::Msg>, msg: Self::Msg, _sender: Sender) {
|
fn recv(&mut self, _ctx: &Context<Self::Msg>, msg: Self::Msg, _sender: Sender) {
|
||||||
@ -36,22 +36,28 @@ impl Actor for SearchActor {
|
|||||||
match msg {
|
match msg {
|
||||||
PostPublished(post) => {
|
PostPublished(post) => {
|
||||||
let conn = self.conn.get();
|
let conn = self.conn.get();
|
||||||
if conn.is_ok() {
|
match conn {
|
||||||
self.searcher
|
Ok(_) => {
|
||||||
.add_document(&conn.unwrap(), &post)
|
self.searcher
|
||||||
.unwrap_or_else(|e| error!("{:?}", e));
|
.add_document(&conn.unwrap(), &post)
|
||||||
} else {
|
.unwrap_or_else(|e| error!("{:?}", e));
|
||||||
error!("Failed to get database connection");
|
},
|
||||||
|
_ => {
|
||||||
|
error!("Failed to get database connection");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PostUpdated(post) => {
|
PostUpdated(post) => {
|
||||||
let conn = self.conn.get();
|
let conn = self.conn.get();
|
||||||
if conn.is_ok() {
|
match conn {
|
||||||
self.searcher
|
Ok(_) => {
|
||||||
.update_document(&conn.unwrap(), &post)
|
self.searcher
|
||||||
.unwrap_or_else(|e| error!("{:?}", e));
|
.update_document(&conn.unwrap(), &post)
|
||||||
} else {
|
.unwrap_or_else(|e| error!("{:?}", e));
|
||||||
error!("Failed to get database connection");
|
},
|
||||||
|
_ => {
|
||||||
|
error!("Failed to get database connection");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PostDeleted(post) => self.searcher.delete_document(&post),
|
PostDeleted(post) => self.searcher.delete_document(&post),
|
||||||
|
@ -90,7 +90,7 @@ impl Searcher {
|
|||||||
}
|
}
|
||||||
open_searcher = Self::open(path, tokenizers);
|
open_searcher = Self::open(path, tokenizers);
|
||||||
}
|
}
|
||||||
let searcher = match open_searcher {
|
match open_searcher {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
Err(Error::Search(e)) => match e {
|
Err(Error::Search(e)) => match e {
|
||||||
SearcherError::WriteLockAcquisitionError => panic!(
|
SearcherError::WriteLockAcquisitionError => panic!(
|
||||||
@ -118,9 +118,7 @@ Then try to restart Plume
|
|||||||
e => Err(e).unwrap(),
|
e => Err(e).unwrap(),
|
||||||
},
|
},
|
||||||
_ => panic!("Unexpected error while opening search index"),
|
_ => panic!("Unexpected error while opening search index"),
|
||||||
};
|
}
|
||||||
|
|
||||||
searcher
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create(path: &dyn AsRef<Path>, tokenizers: &SearchTokenizerConfig) -> Result<Self> {
|
pub fn create(path: &dyn AsRef<Path>, tokenizers: &SearchTokenizerConfig) -> Result<Self> {
|
||||||
|
Loading…
Reference in New Issue
Block a user