From c9a28b506e9d468b3ef4af3f492eeb26abc43178 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Wed, 25 Sep 2019 01:31:32 +0300 Subject: [PATCH 1/2] update redismodeul-rs to safe_context_rm_call --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 82f9e29..7a51877 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ num-traits = "0.2.8" [dependencies.redismodule] git = "https://github.com/redislabsmodules/redismodule-rs.git" -branch = "master" +branch = "safe_context_rm_call" features = ["experimental-api"] # Required by RediSearch [build-dependencies] From 39c65422202d74fe807b58b52a7b5e4561de8647 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Wed, 25 Sep 2019 17:06:08 +0300 Subject: [PATCH 2/2] remove logs --- src/index.rs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/index.rs b/src/index.rs index c61145a..da103d2 100644 --- a/src/index.rs +++ b/src/index.rs @@ -17,23 +17,14 @@ pub struct Field<'a> { field_id: RSFieldID, } -macro_rules! debug { - ($($arg:tt)*) => ({ - println!($($arg)*); - }) -} - impl Index { pub fn create(name: &str) -> Self { - debug!("Creating index '{}'", name); - let name = CString::new(name).unwrap(); let index = unsafe { raw::RediSearch_CreateIndex(name.as_ptr(), ptr::null()) }; Self { inner: index } } pub fn create_with_options(name: &str, options: &IndexOptions) -> Self { - debug!("Creating index with options '{}'", name); let index_options = unsafe { raw::RediSearch_CreateIndexOptions().as_mut() }.expect("null IndexOptions"); @@ -48,7 +39,6 @@ impl Index { } pub fn create_field(&self, name: &str) -> Field { - debug!("Creating index field '{}'", name); let name = CString::new(name).unwrap(); // We want to let the document decide the type, so we support all types. @@ -65,7 +55,6 @@ impl Index { } pub fn add_document(&self, doc: &Document) -> Result<(), RedisError> { - debug!("Adding document to index"); let status = unsafe { raw::RediSearch_IndexAddDocument( self.inner, @@ -133,9 +122,6 @@ impl Iterator for ResultsIterator<'_> { // A null pointer means we have no results. return None; } - - debug!("Getting next result"); - let mut len = 0usize; let key = unsafe { let raw_key = @@ -160,8 +146,6 @@ impl Drop for ResultsIterator<'_> { if self.inner.is_null() { return; } - - debug!("Freeing results iterator"); unsafe { raw::RediSearch_ResultsIteratorFree(self.inner); };