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

Remove dependency on miniutf.

Kishore Nallane558257b5f45
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f8755d6..32441395 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,7 +36,6 @@ FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(ICU REQUIRED)
include(cmake/For.cmake)
-include(cmake/Miniutf.cmake)
include(cmake/H2O.cmake)
include(cmake/RocksDB.cmake)
include(cmake/GoogleTest.cmake)
@@ -50,7 +49,6 @@ include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${CURL_INCLUDE_DIR})
include_directories(${ICU_INCLUDE_DIRS})
include_directories(${DEP_ROOT_DIR}/${FOR_NAME})
-include_directories(${DEP_ROOT_DIR}/${MINIUTF_NAME})
include_directories(${DEP_ROOT_DIR}/${GTEST_NAME}/googletest/include)
include_directories(${DEP_ROOT_DIR}/${H2O_NAME}/include)
include_directories(${DEP_ROOT_DIR}/${ROCKSDB_NAME}/include)
@@ -58,7 +56,6 @@ include_directories(${DEP_ROOT_DIR}/${G3LOG_NAME}/src)
link_directories(${DEP_ROOT_DIR}/${GTEST_NAME}/googletest/build)
link_directories(${DEP_ROOT_DIR}/${FOR_NAME})
-link_directories(${DEP_ROOT_DIR}/${MINIUTF_NAME}/build)
link_directories(${DEP_ROOT_DIR}/${H2O_NAME}/build)
link_directories(${DEP_ROOT_DIR}/${ROCKSDB_NAME})
link_directories(${DEP_ROOT_DIR}/${G3LOG_NAME}/build)
@@ -111,7 +108,7 @@ endif()
set(ICU_ALL_LIBRARIES ${ICU_I18N_LIBRARIES} ${ICU_LIBRARIES} ${ICU_DATA_LIBRARIES})
-target_link_libraries(typesense-server h2o-evloop for miniutf ${ICU_ALL_LIBRARIES} ${G3LOGGER_LIBRARIES} pthread ${CURL_LIBRARIES} ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
-target_link_libraries(search for miniutf ${ICU_ALL_LIBRARIES} ${G3LOGGER_LIBRARIES} pthread h2o-evloop ${CURL_LIBRARIES} ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
-target_link_libraries(benchmark for miniutf ${ICU_ALL_LIBRARIES} ${G3LOGGER_LIBRARIES} pthread ${CURL_LIBRARIES} h2o-evloop ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
-target_link_libraries(typesense_test h2o-evloop ${ICU_ALL_LIBRARIES} ${OPENSSL_LIBRARIES} pthread for miniutf ${G3LOGGER_LIBRARIES} ${ROCKSDB_LIBS} gtest gtest_main dl ${STD_LIB})
+target_link_libraries(typesense-server h2o-evloop for ${ICU_ALL_LIBRARIES} ${G3LOGGER_LIBRARIES} pthread ${CURL_LIBRARIES} ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
+target_link_libraries(search for ${ICU_ALL_LIBRARIES} ${G3LOGGER_LIBRARIES} pthread h2o-evloop ${CURL_LIBRARIES} ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
+target_link_libraries(benchmark for ${ICU_ALL_LIBRARIES} ${G3LOGGER_LIBRARIES} pthread ${CURL_LIBRARIES} h2o-evloop ${ROCKSDB_LIBS} ${OPENSSL_LIBRARIES} dl ${STD_LIB})
+target_link_libraries(typesense_test h2o-evloop ${ICU_ALL_LIBRARIES} ${OPENSSL_LIBRARIES} pthread for ${G3LOGGER_LIBRARIES} ${ROCKSDB_LIBS} gtest gtest_main dl ${STD_LIB})
diff --git a/cmake/Miniutf.cmake b/cmake/Miniutf.cmake
deleted file mode 100644
index 5f584f18..00000000
--- a/cmake/Miniutf.cmake
+++ /dev/null
@@ -1,41 +0,0 @@
-# Download and build MINIUTF
-
-set(MINIUTF_VERSION 8babf72ddc3e85d794af24520483040fcfbf85f8)
-set(MINIUTF_NAME miniutf-${MINIUTF_VERSION})
-set(MINIUTF_TAR_PATH ${DEP_ROOT_DIR}/${MINIUTF_NAME}.tar.gz)
-
-if(NOT EXISTS ${MINIUTF_TAR_PATH})
- message(STATUS "Downloading Miniutf...")
- file(DOWNLOAD https://github.com/dropbox/miniutf/archive/${MINIUTF_VERSION}.tar.gz ${MINIUTF_TAR_PATH})
-endif()
-
-if(NOT EXISTS ${DEP_ROOT_DIR}/${MINIUTF_NAME})
- message(STATUS "Extracting Miniutf...")
- execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${MINIUTF_TAR_PATH} WORKING_DIRECTORY ${DEP_ROOT_DIR})
-endif()
-
-# Copy a custom CMakeLists.txt which we will use for the build
-file(COPY ${CMAKE_SOURCE_DIR}/cmake/patches/miniutf/CMakeLists.txt DESTINATION
- ${DEP_ROOT_DIR}/${MINIUTF_NAME})
-
-if(NOT EXISTS ${DEP_ROOT_DIR}/${MINIUTF_NAME}/build)
- message("Configuring Miniutf...")
- file(MAKE_DIRECTORY ${DEP_ROOT_DIR}/${MINIUTF_NAME}/build)
- execute_process(COMMAND ${CMAKE_COMMAND}
- "-H${DEP_ROOT_DIR}/${MINIUTF_NAME}"
- "-B${DEP_ROOT_DIR}/${MINIUTF_NAME}/build"
- RESULT_VARIABLE
- MINIUTF_CONFIGURE)
- if(NOT MINIUTF_CONFIGURE EQUAL 0)
- message(FATAL_ERROR "Miniutf Configure failed!")
- endif()
-
- message("Building Miniutf locally...")
- execute_process(COMMAND ${CMAKE_COMMAND} --build
- "${DEP_ROOT_DIR}/${MINIUTF_NAME}/build"
- RESULT_VARIABLE
- MINIUTF_BUILD)
- if(NOT MINIUTF_BUILD EQUAL 0)
- message(FATAL_ERROR "Miniutf build failed!")
- endif()
-endif()
\ No newline at end of file
diff --git a/cmake/patches/miniutf/CMakeLists.txt b/cmake/patches/miniutf/CMakeLists.txt
deleted file mode 100644
index ebac5060..00000000
--- a/cmake/patches/miniutf/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-project(miniutf)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11 -O2")
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -std=c++11 -O0")
-
-FILE(GLOB SRC_FILES miniutf.cpp)
-
-add_library(miniutf STATIC ${SRC_FILES})
-target_link_libraries(miniutf)
\ No newline at end of file
diff --git a/include/string_utils.h b/include/string_utils.h
index 77d92465..0dfcfc9d 100644
--- a/include/string_utils.h
+++ b/include/string_utils.h
@@ -4,7 +4,6 @@
#include <algorithm>
#include <sstream>
#include <ctype.h>
-#include "miniutf.hpp"
#include <unicode/translit.h>
#include <vector>
@@ -135,14 +134,6 @@ struct StringUtils {
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
}
- static void normalize(std::string& str) {
- str.erase(std::remove_if(str.begin(), str.end(), [](char c) {
- return !std::isalnum(c) && (int)(c) >= 0;
- }), str.end());
-
- str = miniutf::lowercase(str);
- }
-
void unicode_normalize(std::string& str) const;
/* https://stackoverflow.com/a/34571089/131050 */