Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
16 changes: 0 additions & 16 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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 =
Expand All @@ -160,8 +146,6 @@ impl Drop for ResultsIterator<'_> {
if self.inner.is_null() {
return;
}

debug!("Freeing results iterator");
unsafe {
raw::RediSearch_ResultsIteratorFree(self.inner);
};
Expand Down