prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Allow to search for products by SKU in admin dashboard
  ### What I'm trying to achieve
  I'm looking to find a product by its SKU
  
  ### Describe a proposed solution
  Tweak search engine settings to return products with full/partial SKU match.
  
  
  
  </issue>
  <code>
  [start of saleor/search/backends/postgresql_storefront.py]
  1 from django.contrib.postgres.search import TrigramSimilarity
  2 from django.db.models import Q
  3 
  4 from ...product.models import Product
  5 
  6 
  7 def search(phrase):
  8     """Return matching products for storefront views.
  9 
  10     Fuzzy storefront search that is resistant to small typing errors made
  11     by user. Name is matched using trigram similarity, description uses
  12     standard postgres full text search.
  13 
  14     Args:
  15         phrase (str): searched phrase
  16 
  17     """
  18     name_sim = TrigramSimilarity("name", phrase)
  19     published = Q(is_published=True)
  20     ft_in_description = Q(description__search=phrase)
  21     name_similar = Q(name_sim__gt=0.2)
  22     return Product.objects.annotate(name_sim=name_sim).filter(
  23         (ft_in_description | name_similar) & published
  24     )
  25
  [end of saleor/search/backends/postgresql_storefront.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/saleor/search/backends/postgresql_storefront.py b/saleor/search/backends/postgresql_storefront.py
  --- a/saleor/search/backends/postgresql_storefront.py
  +++ b/saleor/search/backends/postgresql_storefront.py
  @@ -16,9 +16,9 @@
   
       """
       name_sim = TrigramSimilarity("name", phrase)
  -    published = Q(is_published=True)
       ft_in_description = Q(description__search=phrase)
  +    ft_by_sku = Q(variants__sku__search=phrase)
       name_similar = Q(name_sim__gt=0.2)
       return Product.objects.annotate(name_sim=name_sim).filter(
  -        (ft_in_description | name_similar) & published
  +        (ft_in_description | name_similar | ft_by_sku)
       )
  
verification_info: {"golden_diff": "diff --git a/saleor/search/backends/postgresql_storefront.py b/saleor/search/backends/postgresql_storefront.py\n--- a/saleor/search/backends/postgresql_storefront.py\n+++ b/saleor/search/backends/postgresql_storefront.py\n@@ -16,9 +16,9 @@\n \n     \"\"\"\n     name_sim = TrigramSimilarity(\"name\", phrase)\n-    published = Q(is_published=True)\n     ft_in_description = Q(description__search=phrase)\n+    ft_by_sku = Q(variants__sku__search=phrase)\n     name_similar = Q(name_sim__gt=0.2)\n     return Product.objects.annotate(name_sim=name_sim).filter(\n-        (ft_in_description | name_similar) & published\n+        (ft_in_description | name_similar | ft_by_sku)\n     )\n", "issue": "Allow to search for products by SKU in admin dashboard\n### What I'm trying to achieve\r\nI'm looking to find a product by its SKU\r\n\r\n### Describe a proposed solution\r\nTweak search engine settings to return products with full/partial SKU match.\r\n\r\n\n", "before_files": [{"content": "from django.contrib.postgres.search import TrigramSimilarity\nfrom django.db.models import Q\n\nfrom ...product.models import Product\n\n\ndef search(phrase):\n    \"\"\"Return matching products for storefront views.\n\n    Fuzzy storefront search that is resistant to small typing errors made\n    by user. Name is matched using trigram similarity, description uses\n    standard postgres full text search.\n\n    Args:\n        phrase (str): searched phrase\n\n    \"\"\"\n    name_sim = TrigramSimilarity(\"name\", phrase)\n    published = Q(is_published=True)\n    ft_in_description = Q(description__search=phrase)\n    name_similar = Q(name_sim__gt=0.2)\n    return Product.objects.annotate(name_sim=name_sim).filter(\n        (ft_in_description | name_similar) & published\n    )\n", "path": "saleor/search/backends/postgresql_storefront.py"}]}