bugfixes more search results and dump restore options
This commit is contained in:
parent
f4fcf0d9a8
commit
3cd460318a
124 changed files with 3915 additions and 9579 deletions
24
vendor/github.com/blevesearch/bleve/mapping_document.go
generated
vendored
24
vendor/github.com/blevesearch/bleve/mapping_document.go
generated
vendored
|
|
@ -325,6 +325,10 @@ func (dm *DocumentMapping) walkDocument(data interface{}, path []string, indexes
|
|||
for i := 0; i < val.NumField(); i++ {
|
||||
field := typ.Field(i)
|
||||
fieldName := field.Name
|
||||
// anonymous fields of type struct can elide the type name
|
||||
if field.Anonymous && field.Type.Kind() == reflect.Struct {
|
||||
fieldName = ""
|
||||
}
|
||||
|
||||
// if the field has a JSON name, prefer that
|
||||
jsonTag := field.Tag.Get("json")
|
||||
|
|
@ -332,13 +336,18 @@ func (dm *DocumentMapping) walkDocument(data interface{}, path []string, indexes
|
|||
if jsonFieldName == "-" {
|
||||
continue
|
||||
}
|
||||
if jsonFieldName != "" {
|
||||
// allow json tag to set field name to empty, only if anonymous
|
||||
if field.Tag != "" && (jsonFieldName != "" || field.Anonymous) {
|
||||
fieldName = jsonFieldName
|
||||
}
|
||||
|
||||
if val.Field(i).CanInterface() {
|
||||
fieldVal := val.Field(i).Interface()
|
||||
dm.processProperty(fieldVal, append(path, fieldName), indexes, context)
|
||||
newpath := path
|
||||
if fieldName != "" {
|
||||
newpath = append(path, fieldName)
|
||||
}
|
||||
dm.processProperty(fieldVal, newpath, indexes, context)
|
||||
}
|
||||
}
|
||||
case reflect.Slice, reflect.Array:
|
||||
|
|
@ -353,7 +362,18 @@ func (dm *DocumentMapping) walkDocument(data interface{}, path []string, indexes
|
|||
if ptrElem.IsValid() && ptrElem.CanInterface() {
|
||||
dm.processProperty(ptrElem.Interface(), path, indexes, context)
|
||||
}
|
||||
case reflect.String:
|
||||
dm.processProperty(val.String(), path, indexes, context)
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
dm.processProperty(float64(val.Int()), path, indexes, context)
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
dm.processProperty(float64(val.Uint()), path, indexes, context)
|
||||
case reflect.Float32, reflect.Float64:
|
||||
dm.processProperty(float64(val.Float()), path, indexes, context)
|
||||
case reflect.Bool:
|
||||
dm.processProperty(val.Bool(), path, indexes, context)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (dm *DocumentMapping) processProperty(property interface{}, path []string, indexes []uint64, context *walkContext) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue