Skip to content

Commit 384d39e

Browse files
authored
enhance: not build lindera features by default and support make milvus with tantivy features (milvus-io#40813)
relate: milvus-io#39659 Signed-off-by: aoiasd <[email protected]>
1 parent 06310a5 commit 384d39e

File tree

6 files changed

+45
-27
lines changed

6 files changed

+45
-27
lines changed

Makefile

+9-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ ifdef USE_DYNAMIC_SIMD
4040
use_dynamic_simd = ${USE_DYNAMIC_SIMD}
4141
endif
4242

43+
tantivy_features = ""
44+
ifdef TANTIVY_FEATURES
45+
tantivy_features = ${TANTIVY_FEATURES}
46+
endif
47+
4348
use_opendal = OFF
4449
ifdef USE_OPENDAL
4550
use_opendal = ${USE_OPENDAL}
@@ -260,19 +265,19 @@ generated-proto: download-milvus-proto build-3rdparty get-proto-deps
260265

261266
build-cpp: generated-proto
262267
@echo "Building Milvus cpp library ..."
263-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal})
268+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
264269

265270
build-cpp-gpu: generated-proto
266271
@echo "Building Milvus cpp gpu library ... "
267-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -g -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal})
272+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -g -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
268273

269274
build-cpp-with-unittest: generated-proto
270275
@echo "Building Milvus cpp library with unittest ... "
271-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal})
276+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
272277

273278
build-cpp-with-coverage: generated-proto
274279
@echo "Building Milvus cpp library with coverage and unittest ..."
275-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -c -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal})
280+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -c -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
276281

277282
check-proto-product: generated-proto
278283
@(env bash $(PWD)/scripts/check_proto_product.sh)

internal/core/thirdparty/tantivy/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
set(TANTIVY_FEATURES_LIST "" CACHE STRING "List of Cargo features to enable")
2+
string(REPLACE ";" "," TANTIVY_FEATURES "${TANTIVY_FEATURES_LIST}")
3+
14
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
25
set(CARGO_CMD cargo build)
36
set(TARGET_DIR "debug")
@@ -6,6 +9,11 @@ else ()
69
set(TARGET_DIR "release")
710
endif ()
811

12+
if (TANTIVY_FEATURES)
13+
set(CARGO_CMD ${CARGO_CMD} --features ${TANTIVY_FEATURES})
14+
endif ()
15+
message("Cargo command: ${CARGO_CMD}")
16+
917
set(TANTIVY_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
1018
set(TANTIVY_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
1119
set(TANTIVY_NAME "libtantivy_binding${CMAKE_STATIC_LIBRARY_SUFFIX}")

internal/core/thirdparty/tantivy/tantivy-binding/Cargo.lock

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/core/thirdparty/tantivy/tantivy-binding/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[features]
9-
default = ["lindera-ipadic", "lindera-ko-dic", "lindera-cc-cedict"]
9+
default = []
1010
lindera-ipadic = ["lindera/ipadic"]
1111
lindera-ipadic-neologd = ["lindera/ipadic-neologd"]
1212
lindera-unidic = ["lindera/unidic"]
@@ -15,7 +15,7 @@ lindera-cc-cedict = ["lindera/cc-cedict"]
1515

1616
[dependencies]
1717
tantivy = { git = "https://github.com/zilliztech/tantivy.git" }
18-
lindera = "0.38.1"
18+
lindera = "0.40.1"
1919
futures = "0.3.21"
2020
libc = "0.2"
2121
scopeguard = "1.2"

internal/querynodev2/delegator/delegator_data_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,6 @@ func (s *DelegatorDataSuite) TestBuildBM25IDF() {
971971
newGrow = append(newGrow, SegmentEntry{NodeID: 1, SegmentID: seg, TargetVersion: targetVersion})
972972
}
973973

974-
log.Info("Test-", zap.Any("shanshot", snapshot), zap.Any("seg", newSeal))
975974
snapshot.dist[0].Segments = newSeal
976975
snapshot.growing = newGrow
977976
return snapshot

scripts/core_build.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ BUILD_DISK_ANN="OFF"
100100
USE_ASAN="OFF"
101101
USE_DYNAMIC_SIMD="ON"
102102
USE_OPENDAL="OFF"
103+
TANTIVY_FEATURES=""
103104
INDEX_ENGINE="KNOWHERE"
104105
ENABLE_AZURE_FS="OFF"
105106
: "${ENABLE_GCP_NATIVE:="OFF"}"
106107

107-
while getopts "p:d:t:s:f:n:i:y:a:x:o:ulrcghzmebZ" arg; do
108+
while getopts "p:t:u:l:c:g:s:b:n:a:y:Z:x:o:f:" arg; do
108109
case $arg in
109110
p)
110111
INSTALL_PREFIX=$OPTARG
@@ -153,6 +154,9 @@ while getopts "p:d:t:s:f:n:i:y:a:x:o:ulrcghzmebZ" arg; do
153154
o)
154155
USE_OPENDAL=$OPTARG
155156
;;
157+
f)
158+
TANTIVY_FEATURES=$OPTARG
159+
;;
156160
h) # help
157161
echo "
158162
@@ -170,10 +174,11 @@ parameter:
170174
-a: build milvus with AddressSanitizer(default: false)
171175
-Z: build milvus without azure-sdk-for-cpp, so cannot use azure blob
172176
-o: build milvus with opendal(default: false)
177+
-f: build milvus with tantivy features(default: '')
173178
-h: help
174179
175180
usage:
176-
./core_build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} -s \${CUDA_ARCH} [-u] [-l] [-r] [-c] [-z] [-g] [-m] [-e] [-h] [-b] [-o]
181+
./core_build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} -s \${CUDA_ARCH} -f \${TANTIVY_FEATURES} [-u] [-l] [-r] [-c] [-z] [-g] [-m] [-e] [-h] [-b] [-o]
177182
"
178183
exit 0
179184
;;
@@ -258,6 +263,7 @@ ${CMAKE_EXTRA_ARGS} \
258263
-DCPU_ARCH=${CPU_ARCH} \
259264
-DUSE_OPENDAL=${USE_OPENDAL} \
260265
-DINDEX_ENGINE=${INDEX_ENGINE} \
266+
-DTANTIVY_FEATURES_LIST=${TANTIVY_FEATURES} \
261267
-DENABLE_GCP_NATIVE=${ENABLE_GCP_NATIVE} \
262268
-DENABLE_AZURE_FS=${ENABLE_AZURE_FS} "
263269
if [ -z "$BUILD_WITHOUT_AZURE" ]; then

0 commit comments

Comments
 (0)