mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	
							
								
								
									
										26
									
								
								vendor/github.com/blevesearch/bleve/mapping/document.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								vendor/github.com/blevesearch/bleve/mapping/document.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -525,19 +525,27 @@ func (dm *DocumentMapping) processProperty(property interface{}, path []string, | ||||
| 		if !propertyValue.IsNil() { | ||||
| 			switch property := property.(type) { | ||||
| 			case encoding.TextMarshaler: | ||||
|  | ||||
| 				txt, err := property.MarshalText() | ||||
| 				if err == nil && subDocMapping != nil { | ||||
| 					// index by explicit mapping | ||||
| 				// ONLY process TextMarshaler if there is an explicit mapping | ||||
| 				// AND all of the fiels are of type text | ||||
| 				// OTHERWISE process field without TextMarshaler | ||||
| 				if subDocMapping != nil { | ||||
| 					allFieldsText := true | ||||
| 					for _, fieldMapping := range subDocMapping.Fields { | ||||
| 						if fieldMapping.Type == "text" { | ||||
| 							fieldMapping.processString(string(txt), pathString, path, indexes, context) | ||||
| 						if fieldMapping.Type != "text" { | ||||
| 							allFieldsText = false | ||||
| 							break | ||||
| 						} | ||||
| 					} | ||||
| 				} else { | ||||
| 					dm.walkDocument(property, path, indexes, context) | ||||
| 					txt, err := property.MarshalText() | ||||
| 					if err == nil && allFieldsText { | ||||
| 						txtStr := string(txt) | ||||
| 						for _, fieldMapping := range subDocMapping.Fields { | ||||
| 							fieldMapping.processString(txtStr, pathString, path, indexes, context) | ||||
| 						} | ||||
| 						return | ||||
| 					} | ||||
| 				} | ||||
|  | ||||
| 				dm.walkDocument(property, path, indexes, context) | ||||
| 			default: | ||||
| 				dm.walkDocument(property, path, indexes, context) | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user