mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Update to last common bleve (#3986)
This commit is contained in:
		
				
					committed by
					
						 Lunny Xiao
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							1b7cd3d0b0
						
					
				
				
					commit
					917b9641ec
				
			
							
								
								
									
										3
									
								
								vendor/github.com/blevesearch/bleve/mapping/document.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/blevesearch/bleve/mapping/document.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -179,6 +179,7 @@ OUTER: | ||||
| 				continue OUTER | ||||
| 			} | ||||
| 		} | ||||
| 		break | ||||
| 	} | ||||
| 	return current | ||||
| } | ||||
| @@ -503,7 +504,7 @@ func (dm *DocumentMapping) processProperty(property interface{}, path []string, | ||||
| 			} | ||||
| 			dm.walkDocument(property, path, indexes, context) | ||||
| 		} | ||||
| 	case reflect.Map: | ||||
| 	case reflect.Map, reflect.Slice: | ||||
| 		if subDocMapping != nil { | ||||
| 			for _, fieldMapping := range subDocMapping.Fields { | ||||
| 				if fieldMapping.Type == "geopoint" { | ||||
|   | ||||
							
								
								
									
										26
									
								
								vendor/github.com/blevesearch/bleve/mapping/field.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								vendor/github.com/blevesearch/bleve/mapping/field.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -26,8 +26,9 @@ import ( | ||||
|  | ||||
| // control the default behavior for dynamic fields (those not explicitly mapped) | ||||
| var ( | ||||
| 	IndexDynamic = true | ||||
| 	StoreDynamic = true | ||||
| 	IndexDynamic     = true | ||||
| 	StoreDynamic     = true | ||||
| 	DocValuesDynamic = true // TODO revisit default? | ||||
| ) | ||||
|  | ||||
| // A FieldMapping describes how a specific item | ||||
| @@ -54,6 +55,10 @@ type FieldMapping struct { | ||||
| 	IncludeTermVectors bool   `json:"include_term_vectors,omitempty"` | ||||
| 	IncludeInAll       bool   `json:"include_in_all,omitempty"` | ||||
| 	DateFormat         string `json:"date_format,omitempty"` | ||||
|  | ||||
| 	// DocValues, if true makes the index uninverting possible for this field | ||||
| 	// It is useful for faceting and sorting queries. | ||||
| 	DocValues bool `json:"docvalues,omitempty"` | ||||
| } | ||||
|  | ||||
| // NewTextFieldMapping returns a default field mapping for text | ||||
| @@ -64,6 +69,7 @@ func NewTextFieldMapping() *FieldMapping { | ||||
| 		Index:              true, | ||||
| 		IncludeTermVectors: true, | ||||
| 		IncludeInAll:       true, | ||||
| 		DocValues:          true, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -71,6 +77,7 @@ func newTextFieldMappingDynamic(im *IndexMappingImpl) *FieldMapping { | ||||
| 	rv := NewTextFieldMapping() | ||||
| 	rv.Store = im.StoreDynamic | ||||
| 	rv.Index = im.IndexDynamic | ||||
| 	rv.DocValues = im.DocValuesDynamic | ||||
| 	return rv | ||||
| } | ||||
|  | ||||
| @@ -81,6 +88,7 @@ func NewNumericFieldMapping() *FieldMapping { | ||||
| 		Store:        true, | ||||
| 		Index:        true, | ||||
| 		IncludeInAll: true, | ||||
| 		DocValues:    true, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -88,6 +96,7 @@ func newNumericFieldMappingDynamic(im *IndexMappingImpl) *FieldMapping { | ||||
| 	rv := NewNumericFieldMapping() | ||||
| 	rv.Store = im.StoreDynamic | ||||
| 	rv.Index = im.IndexDynamic | ||||
| 	rv.DocValues = im.DocValuesDynamic | ||||
| 	return rv | ||||
| } | ||||
|  | ||||
| @@ -98,6 +107,7 @@ func NewDateTimeFieldMapping() *FieldMapping { | ||||
| 		Store:        true, | ||||
| 		Index:        true, | ||||
| 		IncludeInAll: true, | ||||
| 		DocValues:    true, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -105,6 +115,7 @@ func newDateTimeFieldMappingDynamic(im *IndexMappingImpl) *FieldMapping { | ||||
| 	rv := NewDateTimeFieldMapping() | ||||
| 	rv.Store = im.StoreDynamic | ||||
| 	rv.Index = im.IndexDynamic | ||||
| 	rv.DocValues = im.DocValuesDynamic | ||||
| 	return rv | ||||
| } | ||||
|  | ||||
| @@ -115,6 +126,7 @@ func NewBooleanFieldMapping() *FieldMapping { | ||||
| 		Store:        true, | ||||
| 		Index:        true, | ||||
| 		IncludeInAll: true, | ||||
| 		DocValues:    true, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -122,6 +134,7 @@ func newBooleanFieldMappingDynamic(im *IndexMappingImpl) *FieldMapping { | ||||
| 	rv := NewBooleanFieldMapping() | ||||
| 	rv.Store = im.StoreDynamic | ||||
| 	rv.Index = im.IndexDynamic | ||||
| 	rv.DocValues = im.DocValuesDynamic | ||||
| 	return rv | ||||
| } | ||||
|  | ||||
| @@ -132,6 +145,7 @@ func NewGeoPointFieldMapping() *FieldMapping { | ||||
| 		Store:        true, | ||||
| 		Index:        true, | ||||
| 		IncludeInAll: true, | ||||
| 		DocValues:    true, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -147,6 +161,9 @@ func (fm *FieldMapping) Options() document.IndexingOptions { | ||||
| 	if fm.IncludeTermVectors { | ||||
| 		rv |= document.IncludeTermVectors | ||||
| 	} | ||||
| 	if fm.DocValues { | ||||
| 		rv |= document.DocValues | ||||
| 	} | ||||
| 	return rv | ||||
| } | ||||
|  | ||||
| @@ -308,6 +325,11 @@ func (fm *FieldMapping) UnmarshalJSON(data []byte) error { | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 		case "docvalues": | ||||
| 			err := json.Unmarshal(v, &fm.DocValues) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 		default: | ||||
| 			invalidKeys = append(invalidKeys, k) | ||||
| 		} | ||||
|   | ||||
							
								
								
									
										12
									
								
								vendor/github.com/blevesearch/bleve/mapping/index.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/blevesearch/bleve/mapping/index.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -50,6 +50,7 @@ type IndexMappingImpl struct { | ||||
| 	DefaultField          string                      `json:"default_field"` | ||||
| 	StoreDynamic          bool                        `json:"store_dynamic"` | ||||
| 	IndexDynamic          bool                        `json:"index_dynamic"` | ||||
| 	DocValuesDynamic      bool                        `json:"docvalues_dynamic,omitempty"` | ||||
| 	CustomAnalysis        *customAnalysis             `json:"analysis,omitempty"` | ||||
| 	cache                 *registry.Cache | ||||
| } | ||||
| @@ -154,6 +155,7 @@ func NewIndexMapping() *IndexMappingImpl { | ||||
| 		DefaultField:          defaultField, | ||||
| 		IndexDynamic:          IndexDynamic, | ||||
| 		StoreDynamic:          StoreDynamic, | ||||
| 		DocValuesDynamic:      DocValuesDynamic, | ||||
| 		CustomAnalysis:        newCustomAnalysis(), | ||||
| 		cache:                 registry.NewCache(), | ||||
| 	} | ||||
| @@ -217,6 +219,7 @@ func (im *IndexMappingImpl) UnmarshalJSON(data []byte) error { | ||||
| 	im.TypeMapping = make(map[string]*DocumentMapping) | ||||
| 	im.StoreDynamic = StoreDynamic | ||||
| 	im.IndexDynamic = IndexDynamic | ||||
| 	im.DocValuesDynamic = DocValuesDynamic | ||||
|  | ||||
| 	var invalidKeys []string | ||||
| 	for k, v := range tmp { | ||||
| @@ -271,6 +274,11 @@ func (im *IndexMappingImpl) UnmarshalJSON(data []byte) error { | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 		case "docvalues_dynamic": | ||||
| 			err := json.Unmarshal(v, &im.DocValuesDynamic) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 		default: | ||||
| 			invalidKeys = append(invalidKeys, k) | ||||
| 		} | ||||
| @@ -318,7 +326,7 @@ func (im *IndexMappingImpl) MapDocument(doc *document.Document, data interface{} | ||||
|  | ||||
| 		// see if the _all field was disabled | ||||
| 		allMapping := docMapping.documentMappingForPath("_all") | ||||
| 		if allMapping == nil || (allMapping.Enabled != false) { | ||||
| 		if allMapping == nil || allMapping.Enabled { | ||||
| 			field := document.NewCompositeFieldWithIndexingOptions("_all", true, []string{}, walkContext.excludedFromAll, document.IndexField|document.IncludeTermVectors) | ||||
| 			doc.AddField(field) | ||||
| 		} | ||||
| @@ -339,7 +347,7 @@ func (im *IndexMappingImpl) newWalkContext(doc *document.Document, dm *DocumentM | ||||
| 		doc:             doc, | ||||
| 		im:              im, | ||||
| 		dm:              dm, | ||||
| 		excludedFromAll: []string{}, | ||||
| 		excludedFromAll: []string{"_id"}, | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user