mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
issue: #35528 pr: #36750 this pr includes json path index pr and some related prs: 1. update tantivy version #39253 2. json path index #36750 3. fall back to brute force #40076 4. term filter #40140 5. bug fix #40336 --------- Signed-off-by: sunby <sunbingyi1992@gmail.com>
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package indexparamcheck
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
|
"github.com/milvus-io/milvus/pkg/v2/common"
|
|
"github.com/milvus-io/milvus/pkg/v2/util/merr"
|
|
"github.com/milvus-io/milvus/pkg/v2/util/typeutil"
|
|
)
|
|
|
|
// INVERTEDChecker checks if a INVERTED index can be built.
|
|
type INVERTEDChecker struct {
|
|
scalarIndexChecker
|
|
}
|
|
|
|
func (c *INVERTEDChecker) CheckTrain(dataType schemapb.DataType, params map[string]string) error {
|
|
// check json index params
|
|
isJSONIndex := typeutil.IsJSONType(dataType)
|
|
if isJSONIndex {
|
|
if _, exist := params[common.JSONCastTypeKey]; !exist {
|
|
return merr.WrapErrParameterMissing(common.JSONCastTypeKey, "json index must specify cast type")
|
|
}
|
|
if _, exist := params[common.JSONPathKey]; !exist {
|
|
return merr.WrapErrParameterMissing(common.JSONPathKey, "json index must specify json path")
|
|
}
|
|
}
|
|
return c.scalarIndexChecker.CheckTrain(dataType, params)
|
|
}
|
|
|
|
func (c *INVERTEDChecker) CheckValidDataType(indexType IndexType, field *schemapb.FieldSchema) error {
|
|
dType := field.GetDataType()
|
|
if !typeutil.IsBoolType(dType) && !typeutil.IsArithmetic(dType) && !typeutil.IsStringType(dType) &&
|
|
!typeutil.IsArrayType(dType) && !typeutil.IsJSONType(dType) {
|
|
return fmt.Errorf("INVERTED are not supported on %s field", dType.String())
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func newINVERTEDChecker() *INVERTEDChecker {
|
|
return &INVERTEDChecker{}
|
|
}
|