server/search: fix errors on negative page offsets
This commit is contained in:
		
							parent
							
								
									ba4df16499
								
							
						
					
					
						commit
						e4aa38f159
					
				@ -84,6 +84,10 @@ class Executor:
 | 
			
		||||
        search_query = self.parser.parse(query_text)
 | 
			
		||||
        self.config.on_search_query_parsed(search_query)
 | 
			
		||||
 | 
			
		||||
        if offset < 0:
 | 
			
		||||
            limit = max(0, limit + offset)
 | 
			
		||||
            offset = 0
 | 
			
		||||
 | 
			
		||||
        disable_eager_loads = False
 | 
			
		||||
        for token in search_query.sort_tokens:
 | 
			
		||||
            if token.name == 'random':
 | 
			
		||||
 | 
			
		||||
@ -155,7 +155,8 @@ def test_combining_tokens(
 | 
			
		||||
        (0, 1, 2, ['u1']),
 | 
			
		||||
        (1, 1, 2, ['u2']),
 | 
			
		||||
        (2, 1, 2, []),
 | 
			
		||||
        (-1, 1, 2, ['u1']),
 | 
			
		||||
        (-1, 1, 2, []),
 | 
			
		||||
        (-1, 2, 2, ['u1']),
 | 
			
		||||
        (0, 2, 2, ['u1', 'u2']),
 | 
			
		||||
        (3, 1, 2, []),
 | 
			
		||||
        (0, 0, 2, []),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user