From d2485c4c8a9caaf9a588e11a3b7bc1ca78977d3e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 25 Oct 2021 15:17:07 +0800 Subject: [PATCH] add index test example --- CMakeLists.txt | 1 + source/libs/index/test/indexTests.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abb39c310a..3a2c29ae8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ endif(${BUILD_WITH_ROCKSDB}) ## lucene if(${BUILD_WITH_LUCENE}) cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${DEPS_TMP_FILE}) + add_definitions(-DUSE_LUCENE) endif(${BUILD_WITH_LUCENE}) ## download dependencies diff --git a/source/libs/index/test/indexTests.cpp b/source/libs/index/test/indexTests.cpp index 763a6a54d3..cc0df0d42a 100644 --- a/source/libs/index/test/indexTests.cpp +++ b/source/libs/index/test/indexTests.cpp @@ -15,7 +15,6 @@ TEST(IndexTest, index_create_test) { } - // write for (int i = 0; i < 100000; i++) { SIndexMultiTerm* terms = indexMultiTermCreate(); @@ -32,6 +31,7 @@ TEST(IndexTest, index_create_test) { val.append("const"); indexMultiTermAdd(terms, "tag4", strlen("tag4"), val.c_str(), val.size()); + indexPut(index, terms, i); indexMultiTermDestroy(terms); } @@ -39,6 +39,7 @@ TEST(IndexTest, index_create_test) { // query SIndexMultiTermQuery *multiQuery = indexMultiTermQueryCreate(MUST); + indexMultiTermQueryAdd(multiQuery, "tag1", strlen("tag1"), "field", strlen("field"), QUERY_PREFIX); indexMultiTermQueryAdd(multiQuery, "tag3", strlen("tag3"), "0field0", strlen("0field0"), QUERY_TERM); -- GitLab