mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Fix broken date range search
This commit is contained in:
		
							parent
							
								
									51a5746611
								
							
						
					
					
						commit
						5e9a7b94ba
					
				@ -468,14 +468,16 @@ class DocumentViewSet(
 | 
				
			|||||||
class SearchResultSerializer(DocumentSerializer):
 | 
					class SearchResultSerializer(DocumentSerializer):
 | 
				
			||||||
    def to_representation(self, instance):
 | 
					    def to_representation(self, instance):
 | 
				
			||||||
        doc = Document.objects.get(id=instance["id"])
 | 
					        doc = Document.objects.get(id=instance["id"])
 | 
				
			||||||
        commentTerm = instance.results.q.subqueries[0]
 | 
					        comments = ""
 | 
				
			||||||
        comments = ",".join(
 | 
					        if hasattr(instance.results.q, "subqueries"):
 | 
				
			||||||
            [
 | 
					            commentTerm = instance.results.q.subqueries[0]
 | 
				
			||||||
                str(c.comment)
 | 
					            comments = ",".join(
 | 
				
			||||||
                for c in Comment.objects.filter(document=instance["id"])
 | 
					                [
 | 
				
			||||||
                if commentTerm.text in c.comment
 | 
					                    str(c.comment)
 | 
				
			||||||
            ],
 | 
					                    for c in Comment.objects.filter(document=instance["id"])
 | 
				
			||||||
        )
 | 
					                    if commentTerm.text in c.comment
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
        r = super().to_representation(doc)
 | 
					        r = super().to_representation(doc)
 | 
				
			||||||
        r["__search_hit__"] = {
 | 
					        r["__search_hit__"] = {
 | 
				
			||||||
            "score": instance.score,
 | 
					            "score": instance.score,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user