diff --git a/src/index_options.cpp b/src/index_options.cpp index 9301cc1..3bef8ad 100644 --- a/src/index_options.cpp +++ b/src/index_options.cpp @@ -1,16 +1,17 @@ #include "index_options.h" +#include + #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/numbers.h" #include "absl/strings/str_format.h" -#include "absl/strings/string_view.h" #include "re2/re2.h" namespace vectorlite { absl::StatusOr IndexOptions::FromString( - absl::string_view index_options) { + std::string_view index_options) { static const re2::RE2 hnsw_reg("^hnsw\\((.*)\\)$"); std::string key_value; if (!re2::RE2::FullMatch(index_options, hnsw_reg, &key_value)) { @@ -25,7 +26,7 @@ absl::StatusOr IndexOptions::FromString( std::string key; std::string value; - absl::string_view input(key_value); + std::string_view input(key_value); while (re2::RE2::FindAndConsume(&input, kv_reg, &key, &value)) { if (key == "max_elements") { if (!absl::SimpleAtoi(value, &options.max_elements)) { diff --git a/src/index_options.h b/src/index_options.h index 0a1ae2f..9ed8c15 100644 --- a/src/index_options.h +++ b/src/index_options.h @@ -1,7 +1,8 @@ #pragma once +#include + #include "absl/status/statusor.h" -#include "absl/strings/string_view.h" namespace vectorlite { @@ -21,7 +22,7 @@ struct IndexOptions { // All parameters except max_elemnts are optional, default values are used // if not specified. static absl::StatusOr FromString( - absl::string_view index_options); + std::string_view index_options); }; } // namespace vectorlite \ No newline at end of file diff --git a/src/util.cpp b/src/util.cpp index 516d508..401ddfa 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -11,7 +11,7 @@ namespace vectorlite { -bool IsValidColumnName(absl::string_view name) { +bool IsValidColumnName(std::string_view name) { if (name.empty() || sqlite3_keyword_check(name.data(), name.size()) != 0) { return false; } diff --git a/src/util.h b/src/util.h index d5e452a..e56c359 100644 --- a/src/util.h +++ b/src/util.h @@ -1,9 +1,9 @@ #pragma once #include +#include #include -#include "absl/strings/string_view.h" #include "hnswlib/hnswlib.h" namespace vectorlite { @@ -16,7 +16,7 @@ namespace vectorlite { // - It must not be a reserved keyword. // The input is of string type because built-in regex doesn't work with // string_view -bool IsValidColumnName(absl::string_view name); +bool IsValidColumnName(std::string_view name); // Returns which SIMD instruction set is used at build time. // e.g. SSE, AVX, AVX512 diff --git a/src/vector_space.cpp b/src/vector_space.cpp index 97a4c32..6b2c6db 100644 --- a/src/vector_space.cpp +++ b/src/vector_space.cpp @@ -62,7 +62,7 @@ absl::StatusOr CreateNamedVectorSpace( } absl::StatusOr NamedVectorSpace::FromString( - absl::string_view space_str) { + std::string_view space_str) { static const re2::RE2 reg("([\\w]+)\\((\\d+),\\s*\"([\\w]+)\"\\)"); std::string vector_name; diff --git a/src/vector_space.h b/src/vector_space.h index 640439a..fe0dc9a 100644 --- a/src/vector_space.h +++ b/src/vector_space.h @@ -2,9 +2,9 @@ #include #include +#include #include "absl/status/statusor.h" -#include "absl/strings/string_view.h" #include "hnswlib/hnswlib.h" namespace vectorlite { @@ -38,7 +38,7 @@ struct NamedVectorSpace : public VectorSpace { // "l2"), "hnsw(max_elements=1000)") The `vector(384, "l2")` is the vector // space string. Supported space type are "l2", "cos", "ip" static absl::StatusOr FromString( - absl::string_view space_str); + std::string_view space_str); }; absl::StatusOr CreateNamedVectorSpace( diff --git a/src/virtual_table.cpp b/src/virtual_table.cpp index e97c795..49ce100 100644 --- a/src/virtual_table.cpp +++ b/src/virtual_table.cpp @@ -92,7 +92,7 @@ int VirtualTable::Create(sqlite3* db, void* pAux, int argc, return SQLITE_ERROR; } - absl::string_view index_options_str = argv[1 + kModuleParamOffset]; + std::string_view index_options_str = argv[1 + kModuleParamOffset]; DLOG(INFO) << "index_options_str: " << index_options_str; auto index_options = IndexOptions::FromString(index_options_str); if (!index_options.ok()) {