Skip to content

Commit 29efd5a

Browse files
committed
fix: regression tests
1 parent 0931f96 commit 29efd5a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/server/search/search_family.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,10 +1136,9 @@ void SearchFamily::FtDropIndex(CmdArgList args, const CommandContext& cmd_cntx)
11361136
bool delete_docs = false;
11371137
if (args.size() > 1) {
11381138
string_view option = ArgS(args, 1);
1139+
// Only check for DD option, ignore other arguments for compatibility
11391140
if (absl::EqualsIgnoreCase(option, "DD")) {
11401141
delete_docs = true;
1141-
} else {
1142-
return cmd_cntx.rb->SendError("Unknown argument");
11431142
}
11441143
}
11451144

src/server/search/search_family_test.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3390,18 +3390,18 @@ TEST_F(SearchFamilyTest, DropIndexWithDDJson) {
33903390
TEST_F(SearchFamilyTest, DropIndexWithInvalidOption) {
33913391
// Create an index
33923392
Run({"FT.CREATE", "idx", "ON", "HASH", "PREFIX", "1", "doc:", "SCHEMA", "name", "TEXT"});
3393+
Run({"HSET", "doc:1", "name", "test"});
33933394

3394-
// Try to drop with invalid option
3395+
// Drop with unrecognized option (should be ignored, index dropped but documents remain)
33953396
auto resp = Run({"FT.DROPINDEX", "idx", "INVALID"});
3396-
EXPECT_THAT(resp, ErrArg("Unknown argument"));
3397+
EXPECT_THAT(resp, "OK");
33973398

3398-
// Index should still exist - verify it can be searched
3399-
Run({"HSET", "doc:1", "name", "test"});
3400-
resp = Run({"FT.SEARCH", "idx", "*"});
3401-
EXPECT_THAT(resp, AreDocIds("doc:1"));
3399+
// Document should still exist
3400+
resp = Run({"EXISTS", "doc:1"});
3401+
EXPECT_THAT(resp, IntArg(1));
34023402

34033403
// Clean up
3404-
Run({"FT.DROPINDEX", "idx", "DD"});
3404+
Run({"DEL", "doc:1"});
34053405
}
34063406

34073407
} // namespace dfly

0 commit comments

Comments
 (0)