Skip to content

Commit 7ef845c

Browse files
authored
Merge pull request #6 from RediSearch/safe_context_rm_call
Safe context rm call
2 parents 56fea98 + 15b3ee4 commit 7ef845c

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ num-traits = "0.2.8"
2020

2121
[dependencies.redismodule]
2222
git = "https://github.com/redislabsmodules/redismodule-rs.git"
23-
branch = "master"
23+
branch = "safe_context_rm_call"
2424
features = ["experimental-api"] # Required by RediSearch
2525

2626
[build-dependencies]

src/index.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,14 @@ pub struct Field<'a> {
1717
field_id: RSFieldID,
1818
}
1919

20-
macro_rules! debug {
21-
($($arg:tt)*) => ({
22-
println!($($arg)*);
23-
})
24-
}
25-
2620
impl Index {
2721
pub fn create(name: &str) -> Self {
28-
debug!("Creating index '{}'", name);
29-
3022
let name = CString::new(name).unwrap();
3123
let index = unsafe { raw::RediSearch_CreateIndex(name.as_ptr(), ptr::null()) };
3224
Self { inner: index }
3325
}
3426

3527
pub fn create_with_options(name: &str, options: &IndexOptions) -> Self {
36-
debug!("Creating index with options '{}'", name);
3728
let index_options =
3829
unsafe { raw::RediSearch_CreateIndexOptions().as_mut() }.expect("null IndexOptions");
3930

@@ -48,7 +39,6 @@ impl Index {
4839
}
4940

5041
pub fn create_field(&self, name: &str) -> Field {
51-
debug!("Creating index field '{}'", name);
5242
let name = CString::new(name).unwrap();
5343

5444
// We want to let the document decide the type, so we support all types.
@@ -65,7 +55,6 @@ impl Index {
6555
}
6656

6757
pub fn add_document(&self, doc: &Document) -> Result<(), RedisError> {
68-
debug!("Adding document to index");
6958
let status = unsafe {
7059
raw::RediSearch_IndexAddDocument(
7160
self.inner,
@@ -133,9 +122,6 @@ impl Iterator for ResultsIterator<'_> {
133122
// A null pointer means we have no results.
134123
return None;
135124
}
136-
137-
debug!("Getting next result");
138-
139125
let mut len = 0usize;
140126
let key = unsafe {
141127
let raw_key =
@@ -160,8 +146,6 @@ impl Drop for ResultsIterator<'_> {
160146
if self.inner.is_null() {
161147
return;
162148
}
163-
164-
debug!("Freeing results iterator");
165149
unsafe {
166150
raw::RediSearch_ResultsIteratorFree(self.inner);
167151
};

0 commit comments

Comments
 (0)