Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Experimenting with ICU linking options.

Kishore Nallanddcb89843f57
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae06d4bc..0cc36b6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,10 +72,27 @@ add_executable(typesense_test ${SRC_FILES} test/main.cpp test/array_test.cpp tes
test/string_utils_test.cpp)
set(TYPESENSE_VERSION "nightly" CACHE STRING "") # will be overridden from command line during a release build
-target_compile_definitions(typesense-server PRIVATE TYPESENSE_VERSION="${TYPESENSE_VERSION}")
-target_compile_definitions(benchmark PRIVATE TYPESENSE_VERSION="${TYPESENSE_VERSION}")
-target_compile_definitions(search PRIVATE TYPESENSE_VERSION="${TYPESENSE_VERSION}")
-target_compile_definitions(typesense_test PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}/" TYPESENSE_VERSION="${TYPESENSE_VERSION}")
+
+target_compile_definitions(
+ typesense-server PRIVATE
+ TYPESENSE_VERSION="${TYPESENSE_VERSION}"
+)
+
+target_compile_definitions(
+ benchmark PRIVATE
+ TYPESENSE_VERSION="${TYPESENSE_VERSION}"
+)
+
+target_compile_definitions(
+ search PRIVATE
+ TYPESENSE_VERSION="${TYPESENSE_VERSION}"
+)
+
+target_compile_definitions(
+ typesense_test PRIVATE
+ ROOT_DIR="${CMAKE_SOURCE_DIR}/"
+ TYPESENSE_VERSION="${TYPESENSE_VERSION}"
+)
if (APPLE)
set(STD_LIB -static-libstdc++) # https://stackoverflow.com/a/26543140/131050 (can't statically link libgcc on Mac)
diff --git a/include/string_utils.h b/include/string_utils.h
index 015f1efd..77d92465 100644
--- a/include/string_utils.h
+++ b/include/string_utils.h
@@ -1,9 +1,5 @@
#pragma once
-#define U_USING_ICU_NAMESPACE 0
-#define U_STATIC_IMPLEMENTATION 1
-//#define U_DISABLE_RENAMING 1
-
#include <string>
#include <algorithm>
#include <sstream>
diff --git a/src/string_utils.cpp b/src/string_utils.cpp
index 98180bd7..80e9a76d 100644
--- a/src/string_utils.cpp
+++ b/src/string_utils.cpp
@@ -6,7 +6,7 @@ void StringUtils::unicode_normalize(std::string& str) const {
return !std::isalnum(c) && (int)(c) >= 0;
}), str.end());
- UnicodeString u_str = UnicodeString::fromUTF8(str);
+ icu::UnicodeString u_str = icu::UnicodeString::fromUTF8(str);
transliterator->transliterate(u_str);
str.clear();
u_str.toLower().toUTF8String(str);