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
				
			
							
								
								
									
										10
									
								
								vendor/github.com/blevesearch/bleve/search/search.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/blevesearch/bleve/search/search.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -37,12 +37,12 @@ func (ap ArrayPositions) Equals(other ArrayPositions) bool { | ||||
|  | ||||
| type Location struct { | ||||
| 	// Pos is the position of the term within the field, starting at 1 | ||||
| 	Pos            uint64         `json:"pos"` | ||||
| 	 | ||||
| 	Pos uint64 `json:"pos"` | ||||
|  | ||||
| 	// Start and End are the byte offsets of the term in the field | ||||
| 	Start          uint64         `json:"start"` | ||||
| 	End            uint64         `json:"end"` | ||||
| 	 | ||||
| 	Start uint64 `json:"start"` | ||||
| 	End   uint64 `json:"end"` | ||||
|  | ||||
| 	// ArrayPositions contains the positions of the term within any elements. | ||||
| 	ArrayPositions ArrayPositions `json:"array_positions"` | ||||
| } | ||||
|   | ||||
							
								
								
									
										19
									
								
								vendor/github.com/blevesearch/bleve/search/searcher/search_conjunction.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/github.com/blevesearch/bleve/search/searcher/search_conjunction.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -57,25 +57,25 @@ func NewConjunctionSearcher(indexReader index.IndexReader, qsearchers []search.S | ||||
| func (s *ConjunctionSearcher) computeQueryNorm() { | ||||
| 	// first calculate sum of squared weights | ||||
| 	sumOfSquaredWeights := 0.0 | ||||
| 	for _, termSearcher := range s.searchers { | ||||
| 		sumOfSquaredWeights += termSearcher.Weight() | ||||
| 	for _, searcher := range s.searchers { | ||||
| 		sumOfSquaredWeights += searcher.Weight() | ||||
| 	} | ||||
| 	// now compute query norm from this | ||||
| 	s.queryNorm = 1.0 / math.Sqrt(sumOfSquaredWeights) | ||||
| 	// finally tell all the downstream searchers the norm | ||||
| 	for _, termSearcher := range s.searchers { | ||||
| 		termSearcher.SetQueryNorm(s.queryNorm) | ||||
| 	for _, searcher := range s.searchers { | ||||
| 		searcher.SetQueryNorm(s.queryNorm) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (s *ConjunctionSearcher) initSearchers(ctx *search.SearchContext) error { | ||||
| 	var err error | ||||
| 	// get all searchers pointing at their first match | ||||
| 	for i, termSearcher := range s.searchers { | ||||
| 	for i, searcher := range s.searchers { | ||||
| 		if s.currs[i] != nil { | ||||
| 			ctx.DocumentMatchPool.Put(s.currs[i]) | ||||
| 		} | ||||
| 		s.currs[i], err = termSearcher.Next(ctx) | ||||
| 		s.currs[i], err = searcher.Next(ctx) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| @@ -160,11 +160,11 @@ OUTER: | ||||
|  | ||||
| 		// we know all the searchers are pointing at the same thing | ||||
| 		// so they all need to be bumped | ||||
| 		for i, termSearcher := range s.searchers { | ||||
| 		for i, searcher := range s.searchers { | ||||
| 			if s.currs[i] != rv { | ||||
| 				ctx.DocumentMatchPool.Put(s.currs[i]) | ||||
| 			} | ||||
| 			s.currs[i], err = termSearcher.Next(ctx) | ||||
| 			s.currs[i], err = searcher.Next(ctx) | ||||
| 			if err != nil { | ||||
| 				return nil, err | ||||
| 			} | ||||
| @@ -184,6 +184,9 @@ func (s *ConjunctionSearcher) Advance(ctx *search.SearchContext, ID index.IndexI | ||||
| 		} | ||||
| 	} | ||||
| 	for i := range s.searchers { | ||||
| 		if s.currs[i] != nil && s.currs[i].IndexInternalID.Compare(ID) >= 0 { | ||||
| 			continue | ||||
| 		} | ||||
| 		err := s.advanceChild(ctx, i, ID) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
|   | ||||
							
								
								
									
										19
									
								
								vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -93,25 +93,25 @@ func newDisjunctionSearcher(indexReader index.IndexReader, | ||||
| func (s *DisjunctionSearcher) computeQueryNorm() { | ||||
| 	// first calculate sum of squared weights | ||||
| 	sumOfSquaredWeights := 0.0 | ||||
| 	for _, termSearcher := range s.searchers { | ||||
| 		sumOfSquaredWeights += termSearcher.Weight() | ||||
| 	for _, searcher := range s.searchers { | ||||
| 		sumOfSquaredWeights += searcher.Weight() | ||||
| 	} | ||||
| 	// now compute query norm from this | ||||
| 	s.queryNorm = 1.0 / math.Sqrt(sumOfSquaredWeights) | ||||
| 	// finally tell all the downstream searchers the norm | ||||
| 	for _, termSearcher := range s.searchers { | ||||
| 		termSearcher.SetQueryNorm(s.queryNorm) | ||||
| 	for _, searcher := range s.searchers { | ||||
| 		searcher.SetQueryNorm(s.queryNorm) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (s *DisjunctionSearcher) initSearchers(ctx *search.SearchContext) error { | ||||
| 	var err error | ||||
| 	// get all searchers pointing at their first match | ||||
| 	for i, termSearcher := range s.searchers { | ||||
| 	for i, searcher := range s.searchers { | ||||
| 		if s.currs[i] != nil { | ||||
| 			ctx.DocumentMatchPool.Put(s.currs[i]) | ||||
| 		} | ||||
| 		s.currs[i], err = termSearcher.Next(ctx) | ||||
| 		s.currs[i], err = searcher.Next(ctx) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| @@ -221,11 +221,14 @@ func (s *DisjunctionSearcher) Advance(ctx *search.SearchContext, | ||||
| 	} | ||||
| 	// get all searchers pointing at their first match | ||||
| 	var err error | ||||
| 	for i, termSearcher := range s.searchers { | ||||
| 	for i, searcher := range s.searchers { | ||||
| 		if s.currs[i] != nil { | ||||
| 			if s.currs[i].IndexInternalID.Compare(ID) >= 0 { | ||||
| 				continue | ||||
| 			} | ||||
| 			ctx.DocumentMatchPool.Put(s.currs[i]) | ||||
| 		} | ||||
| 		s.currs[i], err = termSearcher.Advance(ctx, ID) | ||||
| 		s.currs[i], err = searcher.Advance(ctx, ID) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
|   | ||||
							
								
								
									
										13
									
								
								vendor/github.com/blevesearch/bleve/search/searcher/search_phrase.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/github.com/blevesearch/bleve/search/searcher/search_phrase.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -226,6 +226,10 @@ type phrasePart struct { | ||||
| 	loc  *search.Location | ||||
| } | ||||
|  | ||||
| func (p *phrasePart) String() string { | ||||
| 	return fmt.Sprintf("[%s %v]", p.term, p.loc) | ||||
| } | ||||
|  | ||||
| type phrasePath []*phrasePart | ||||
|  | ||||
| func (p phrasePath) MergeInto(in search.TermLocationMap) { | ||||
| @@ -309,6 +313,15 @@ func (s *PhraseSearcher) Advance(ctx *search.SearchContext, ID index.IndexIntern | ||||
| 			return nil, err | ||||
| 		} | ||||
| 	} | ||||
| 	if s.currMust != nil { | ||||
| 		if s.currMust.IndexInternalID.Compare(ID) >= 0 { | ||||
| 			return s.Next(ctx) | ||||
| 		} | ||||
| 		ctx.DocumentMatchPool.Put(s.currMust) | ||||
| 	} | ||||
| 	if s.currMust == nil { | ||||
| 		return nil, nil | ||||
| 	} | ||||
| 	var err error | ||||
| 	s.currMust, err = s.mustSearcher.Advance(ctx, ID) | ||||
| 	if err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user