@@ -1133,14 +1133,7 @@ void SearchFamily::FtDropIndex(CmdArgList args, const CommandContext& cmd_cntx)
11331133 string_view idx_name = ArgS (args, 0 );
11341134
11351135 // Parse optional DD (Delete Documents) parameter
1136- bool delete_docs = false ;
1137- if (args.size () > 1 ) {
1138- string_view option = ArgS (args, 1 );
1139- // Only check for DD option, ignore other arguments for compatibility
1140- if (absl::EqualsIgnoreCase (option, " DD" )) {
1141- delete_docs = true ;
1142- }
1143- }
1136+ bool delete_docs = args.size () > 1 && absl::EqualsIgnoreCase (args[1 ], " DD" );
11441137
11451138 atomic_uint num_deleted{0 };
11461139
@@ -1157,15 +1150,13 @@ void SearchFamily::FtDropIndex(CmdArgList args, const CommandContext& cmd_cntx)
11571150 // Get const reference to document keys map (index will be destroyed after this scope)
11581151 const auto & doc_keys = index->key_index ().GetDocKeysMap ();
11591152
1160- if (!doc_keys.empty ()) {
1161- auto op_args = t->GetOpArgs (es);
1162- auto & db_slice = op_args.GetDbSlice ();
1153+ auto op_args = t->GetOpArgs (es);
1154+ auto & db_slice = op_args.GetDbSlice ();
11631155
1164- for (const auto & [key, doc_id] : doc_keys) {
1165- auto it = db_slice.FindMutable (op_args.db_cntx , key).it ;
1166- if (IsValid (it)) {
1167- db_slice.Del (op_args.db_cntx , it);
1168- }
1156+ for (const auto & [key, doc_id] : doc_keys) {
1157+ auto it = db_slice.FindMutable (op_args.db_cntx , key).it ;
1158+ if (IsValid (it)) {
1159+ db_slice.Del (op_args.db_cntx , it);
11691160 }
11701161 }
11711162 }
0 commit comments