Documentation ¶
Index ¶
- Constants
- Variables
- func Equals(f1, f2 FieldMappingI) bool
- func MergeSchema(old, new []byte) ([]byte, error)
- func SchemaMap(schema []byte) (map[string]FieldMappingI, error)
- type BaseFieldMapping
- type BooleanFieldMapping
- type DateFieldMapping
- type DocumentMapping
- type FieldMapping
- type FieldMappingI
- type GeoPointFieldMapping
- type IndexMapping
- func (im *IndexMapping) GetDocument(path string) *DocumentMapping
- func (im *IndexMapping) GetField(path string) *FieldMapping
- func (im *IndexMapping) GetFieldsType() map[string]pspb.FieldType
- func (im *IndexMapping) InitFieldCache()
- func (im *IndexMapping) MapDocument(source []byte) ([]*pspb.Field, map[string]pspb.FieldType, error)
- func (im *IndexMapping) RangeField(f func(key string, value *DocumentMapping) error) error
- type NumericFieldMapping
- type StringFieldMapping
- type VectortFieldMapping
Constants ¶
View Source
const ( IndexField = "_index" UidField = "_uid" TypeField = "_type" IdField = "_id" SourceField = "_source" SizeField = "_size" AllField = "_all" FieldNamesField = "_field_names" IgnoredField = "_ignored" RoutingField = "_routing" MetaField = "_meta" VersionField = "_version" SlotField = "_slot" )
Variables ¶
View Source
var FieldsIndex = map[string]int{ IndexField: 1, UidField: 2, TypeField: 3, IdField: 4, SourceField: 5, SizeField: 6, AllField: 7, FieldNamesField: 8, IgnoredField: 9, RoutingField: 10, MetaField: 11, VersionField: 12, SlotField: 13, }
Functions ¶
func Equals ¶
func Equals(f1, f2 FieldMappingI) bool
Types ¶
type BaseFieldMapping ¶
type BaseFieldMapping struct { Type pspb.FieldType `json:"type"` Name string `json:"_"` Boost float64 `json:"boost,omitempty"` Option pspb.FieldOption `json:"option,omitempty"` Array bool `json:"array,omitempty"` }
func NewBaseFieldMapping ¶
func NewBaseFieldMapping(name string, fieldType pspb.FieldType, boost float64, option pspb.FieldOption) *BaseFieldMapping
func (*BaseFieldMapping) Base ¶
func (f *BaseFieldMapping) Base() *BaseFieldMapping
func (*BaseFieldMapping) FieldName ¶
func (f *BaseFieldMapping) FieldName() string
func (*BaseFieldMapping) FieldType ¶
func (f *BaseFieldMapping) FieldType() pspb.FieldType
func (*BaseFieldMapping) IsArray ¶
func (f *BaseFieldMapping) IsArray() bool
func (*BaseFieldMapping) Options ¶
func (f *BaseFieldMapping) Options() pspb.FieldOption
type BooleanFieldMapping ¶
type BooleanFieldMapping struct { *BaseFieldMapping NullValue string `json:"null_value,omitempty"` }
func NewBooleanFieldMapping ¶
func NewBooleanFieldMapping(name string) *BooleanFieldMapping
type DateFieldMapping ¶
type DateFieldMapping struct { *BaseFieldMapping Format string `json:"format,omitempty"` Locale string `json:"locale,omitempty"` NullValue string `json:"null_value,omitempty"` IgnoreMalformed bool `json:"ignore_malformed"` }
func NewDateFieldMapping ¶
func NewDateFieldMapping(name string) *DateFieldMapping
type DocumentMapping ¶
type DocumentMapping struct { Properties map[string]*DocumentMapping `json:"properties,omitempty"` Field *FieldMapping `json:"field,omitempty"` }
func NewDocumentMapping ¶
func NewDocumentMapping() *DocumentMapping
func ParseSchema ¶
func ParseSchema(schema []byte) (*DocumentMapping, error)
func (*DocumentMapping) UnmarshalJSON ¶
func (dm *DocumentMapping) UnmarshalJSON(data []byte) error
type FieldMapping ¶
type FieldMapping struct { Name string FieldMappingI }
func NewFieldMapping ¶
func NewFieldMapping(name string, i FieldMappingI) *FieldMapping
func (*FieldMapping) UnmarshalJSON ¶
func (f *FieldMapping) UnmarshalJSON(data []byte) error
type FieldMappingI ¶
type FieldMappingI interface { FieldName() string FieldType() pspb.FieldType Options() pspb.FieldOption Base() *BaseFieldMapping IsArray() bool }
type GeoPointFieldMapping ¶
type GeoPointFieldMapping struct { *BaseFieldMapping IgnoreZValue bool `json:"ignore_z_value,omitempty"` NullValue string `json:"null_value,omitempty"` }
func NewGeoPointFieldMapping ¶
func NewGeoPointFieldMapping(name string) *GeoPointFieldMapping
type IndexMapping ¶
type IndexMapping struct { DocumentMapping *DocumentMapping `json:"doc_mapping"` //it is not config in index DefaultDateTimeParserName string `json:"-"` // contains filtered or unexported fields }
An IndexMapping controls how objects are placed into an index. First the type of the object is determined. Once the type is know, the appropriate DocumentMapping is selected by the type. If no mapping was determined for that type, a DefaultMapping will be used.
func NewIndexMapping ¶
func NewIndexMapping() *IndexMapping
NewIndexMapping creates a new IndexMapping that will use all the default indexing rules
func Space2Mapping ¶
func Space2Mapping(space *entity.Space) (indexMapping *IndexMapping, err error)
func (*IndexMapping) GetDocument ¶
func (im *IndexMapping) GetDocument(path string) *DocumentMapping
you can use it like dm.DocumentMappingForField("person.name")
func (*IndexMapping) GetField ¶
func (im *IndexMapping) GetField(path string) *FieldMapping
you can use it like dm.DocumentMappingForField("person.name")
func (*IndexMapping) GetFieldsType ¶
func (im *IndexMapping) GetFieldsType() map[string]pspb.FieldType
func (*IndexMapping) InitFieldCache ¶
func (im *IndexMapping) InitFieldCache()
func (*IndexMapping) MapDocument ¶
func (*IndexMapping) RangeField ¶
func (im *IndexMapping) RangeField(f func(key string, value *DocumentMapping) error) error
type NumericFieldMapping ¶
type NumericFieldMapping struct { *BaseFieldMapping NullValue string `json:"null_value,omitempty"` Coerce bool `json:"coerce"` IgnoreMalformed bool `json:"ignore_malformed"` }
func NewFloatFieldMapping ¶
func NewFloatFieldMapping(name string) *NumericFieldMapping
func NewIntegerFieldMapping ¶
func NewIntegerFieldMapping(name string) *NumericFieldMapping
type StringFieldMapping ¶
type StringFieldMapping struct { *BaseFieldMapping NullValue string `json:"null_value,omitempty"` }
func NewStringFieldMapping ¶
func NewStringFieldMapping(name string) *StringFieldMapping
type VectortFieldMapping ¶
type VectortFieldMapping struct { *BaseFieldMapping Dimension int `json:"dimension"` ModelId string `json:"model_id"` Format *string `json:"format,omitempty"` //"normalization", "normal" RetrievalType string `json:"retrieval_type,omitempty"` // "IVFPQ", "PACINS", ... StoreType string `json:"store_type,omitempty"` // "Mmap", "RocksDB" StoreParam []byte `json:"store_param,omitempty"` }
func NewVectorFieldMapping ¶
func NewVectorFieldMapping(name string) *VectortFieldMapping
Click to show internal directories.
Click to hide internal directories.