mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Improve issue search (#2387)
* Improve issue indexer * Fix new issue sqlite bug * Different test indexer paths for each db * Add integration indexer paths to make clean
This commit is contained in:
		
							
								
								
									
										53
									
								
								vendor/github.com/blevesearch/bleve/mapping/document.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										53
									
								
								vendor/github.com/blevesearch/bleve/mapping/document.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -15,6 +15,7 @@ | ||||
| package mapping | ||||
|  | ||||
| import ( | ||||
| 	"encoding" | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| 	"reflect" | ||||
| @@ -75,7 +76,7 @@ func (dm *DocumentMapping) Validate(cache *registry.Cache) error { | ||||
| 			} | ||||
| 		} | ||||
| 		switch field.Type { | ||||
| 		case "text", "datetime", "number", "boolean": | ||||
| 		case "text", "datetime", "number", "boolean", "geopoint": | ||||
| 		default: | ||||
| 			return fmt.Errorf("unknown field type: '%s'", field.Type) | ||||
| 		} | ||||
| @@ -481,8 +482,56 @@ func (dm *DocumentMapping) processProperty(property interface{}, path []string, | ||||
| 				fieldMapping := newDateTimeFieldMappingDynamic(context.im) | ||||
| 				fieldMapping.processTime(property, pathString, path, indexes, context) | ||||
| 			} | ||||
| 		default: | ||||
| 		case encoding.TextMarshaler: | ||||
| 			txt, err := property.MarshalText() | ||||
| 			if err == nil && subDocMapping != nil { | ||||
| 				// index by explicit mapping | ||||
| 				for _, fieldMapping := range subDocMapping.Fields { | ||||
| 					if fieldMapping.Type == "text" { | ||||
| 						fieldMapping.processString(string(txt), pathString, path, indexes, context) | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			dm.walkDocument(property, path, indexes, context) | ||||
| 		default: | ||||
| 			if subDocMapping != nil { | ||||
| 				for _, fieldMapping := range subDocMapping.Fields { | ||||
| 					if fieldMapping.Type == "geopoint" { | ||||
| 						fieldMapping.processGeoPoint(property, pathString, path, indexes, context) | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			dm.walkDocument(property, path, indexes, context) | ||||
| 		} | ||||
| 	case reflect.Map: | ||||
| 		if subDocMapping != nil { | ||||
| 			for _, fieldMapping := range subDocMapping.Fields { | ||||
| 				if fieldMapping.Type == "geopoint" { | ||||
| 					fieldMapping.processGeoPoint(property, pathString, path, indexes, context) | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		dm.walkDocument(property, path, indexes, context) | ||||
| 	case reflect.Ptr: | ||||
| 		if !propertyValue.IsNil() { | ||||
| 			switch property := property.(type) { | ||||
| 			case encoding.TextMarshaler: | ||||
|  | ||||
| 				txt, err := property.MarshalText() | ||||
| 				if err == nil && subDocMapping != nil { | ||||
| 					// index by explicit mapping | ||||
| 					for _, fieldMapping := range subDocMapping.Fields { | ||||
| 						if fieldMapping.Type == "text" { | ||||
| 							fieldMapping.processString(string(txt), pathString, path, indexes, context) | ||||
| 						} | ||||
| 					} | ||||
| 				} else { | ||||
| 					dm.walkDocument(property, path, indexes, context) | ||||
| 				} | ||||
|  | ||||
| 			default: | ||||
| 				dm.walkDocument(property, path, indexes, context) | ||||
| 			} | ||||
| 		} | ||||
| 	default: | ||||
| 		dm.walkDocument(property, path, indexes, context) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user