mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -05:00 
			
		
		
		
	lazy load fuzzy only when required
This commit is contained in:
		
							parent
							
								
									431d4fd8e4
								
							
						
					
					
						commit
						96d7114fa7
					
				@ -1,7 +1,6 @@
 | 
				
			|||||||
import logging
 | 
					import logging
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from fuzzywuzzy import fuzz
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
from documents.models import MatchingModel, Correspondent, DocumentType, Tag
 | 
					from documents.models import MatchingModel, Correspondent, DocumentType, Tag
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -123,6 +122,8 @@ def matches(matching_model, document):
 | 
				
			|||||||
        return bool(match)
 | 
					        return bool(match)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    elif matching_model.matching_algorithm == MatchingModel.MATCH_FUZZY:
 | 
					    elif matching_model.matching_algorithm == MatchingModel.MATCH_FUZZY:
 | 
				
			||||||
 | 
					        from fuzzywuzzy import fuzz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        match = re.sub(r'[^\w\s]', '', matching_model.match)
 | 
					        match = re.sub(r'[^\w\s]', '', matching_model.match)
 | 
				
			||||||
        text = re.sub(r'[^\w\s]', '', document_content)
 | 
					        text = re.sub(r'[^\w\s]', '', document_content)
 | 
				
			||||||
        if matching_model.is_insensitive:
 | 
					        if matching_model.is_insensitive:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user