add index test example
This commit is contained in:
parent
8721dc4408
commit
d2485c4c8a
|
@ -48,6 +48,7 @@ endif(${BUILD_WITH_ROCKSDB})
|
||||||
## lucene
|
## lucene
|
||||||
if(${BUILD_WITH_LUCENE})
|
if(${BUILD_WITH_LUCENE})
|
||||||
cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${DEPS_TMP_FILE})
|
cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${DEPS_TMP_FILE})
|
||||||
|
add_definitions(-DUSE_LUCENE)
|
||||||
endif(${BUILD_WITH_LUCENE})
|
endif(${BUILD_WITH_LUCENE})
|
||||||
|
|
||||||
## download dependencies
|
## download dependencies
|
||||||
|
|
|
@ -15,7 +15,6 @@ TEST(IndexTest, index_create_test) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// write
|
// write
|
||||||
for (int i = 0; i < 100000; i++) {
|
for (int i = 0; i < 100000; i++) {
|
||||||
SIndexMultiTerm* terms = indexMultiTermCreate();
|
SIndexMultiTerm* terms = indexMultiTermCreate();
|
||||||
|
@ -32,6 +31,7 @@ TEST(IndexTest, index_create_test) {
|
||||||
val.append("const");
|
val.append("const");
|
||||||
indexMultiTermAdd(terms, "tag4", strlen("tag4"), val.c_str(), val.size());
|
indexMultiTermAdd(terms, "tag4", strlen("tag4"), val.c_str(), val.size());
|
||||||
|
|
||||||
|
|
||||||
indexPut(index, terms, i);
|
indexPut(index, terms, i);
|
||||||
indexMultiTermDestroy(terms);
|
indexMultiTermDestroy(terms);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ TEST(IndexTest, index_create_test) {
|
||||||
|
|
||||||
// query
|
// query
|
||||||
SIndexMultiTermQuery *multiQuery = indexMultiTermQueryCreate(MUST);
|
SIndexMultiTermQuery *multiQuery = indexMultiTermQueryCreate(MUST);
|
||||||
|
|
||||||
indexMultiTermQueryAdd(multiQuery, "tag1", strlen("tag1"), "field", strlen("field"), QUERY_PREFIX);
|
indexMultiTermQueryAdd(multiQuery, "tag1", strlen("tag1"), "field", strlen("field"), QUERY_PREFIX);
|
||||||
indexMultiTermQueryAdd(multiQuery, "tag3", strlen("tag3"), "0field0", strlen("0field0"), QUERY_TERM);
|
indexMultiTermQueryAdd(multiQuery, "tag3", strlen("tag3"), "0field0", strlen("0field0"), QUERY_TERM);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue