diff --git a/db/db_impl.cc b/db/db_impl.cc index 97b43ae..565fbba 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1222,7 +1222,7 @@ std::vector DBImpl::FindKeysByField(Field &field) { std::string key = iter->key().ToString(); Fields fields = iter->fields(); - if (fields.find(field.first) == field.second) { + if (fields[field.first] == field.second) { keys.emplace_back(key); } iter->Next(); diff --git a/db/fields.cc b/db/fields.cc index 1281627..dd37277 100644 --- a/db/fields.cc +++ b/db/fields.cc @@ -69,14 +69,4 @@ namespace leveldb { return field_array; } - - std::string Fields::find(const std::string& field_name) const { - auto it = this->_fields.find(field_name); - if (it == this->_fields.end()) { - return ""; - } - return it->second; - } - - } // namespace leveldb \ No newline at end of file diff --git a/db/fields.h b/db/fields.h index 9cfc5a9..411a29b 100644 --- a/db/fields.h +++ b/db/fields.h @@ -33,8 +33,6 @@ namespace leveldb { // 将Fields编码为存入LevelDB的Value std::string Serialize() const; - // 通过field_name得到相应的字段值 - std::string find(const std::string& field_name) const; private: std::map _fields; };