Skip to content
Open
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
1 change: 1 addition & 0 deletions src/commands/impls/redisearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ fn gen_search_options(args: &mut Vec<Value>, options: FtSearchOptions) -> Result
}
if !options.params.is_empty() {
args.push(static_val!(PARAMS));
// TODO: times 2 for the number of arguments, no the number of pairs
args.push(options.params.len().try_into()?);
Comment on lines +322 to 323
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t have an environment to easily run the test suite so I was hoping for this first commit without the fix to witness a failing CI run, but it looks like CI is not enabled on PRs from forks. The fix below works for me:

Suggested change
// TODO: times 2 for the number of arguments, no the number of pairs
args.push(options.params.len().try_into()?);
args.push((options.params.len() * 2).try_into()?);

for param in options.params.into_iter() {
args.extend([param.name.into(), param.value.into()]);
Expand Down
8 changes: 7 additions & 1 deletion tests/integration/redisearch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use fred::{
FtSearchOptions,
IndexKind,
Load,
SearchParameter,
SearchSchema,
SearchSchemaKind,
},
Expand Down Expand Up @@ -166,8 +167,13 @@ pub async fn should_index_and_search_hash(client: Client, _: Config) -> Result<(
.await?;
assert_eq!(results, (3, "record:1".into(), "record:2".into(), "record:3".into()));
let results: (usize, Key, Key) = client
.ft_search("foo_idx", "@bar:(abc)", FtSearchOptions {
.ft_search("foo_idx", "@bar:($x)", FtSearchOptions {
nocontent: true,
params: vec![SearchParameter {
name: "x".into(),
value: "abc".into(),
}],
dialect: Some(2),
..Default::default()
})
.await?;
Expand Down