add index test example

This commit is contained in:
yihaoDeng 2021-10-25 15:17:07 +08:00
parent 8721dc4408
commit d2485c4c8a
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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);