We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
non-EUTF search results appearing (estimate: 8)
Created via Reamaze:

Link: https://akvoo.reamaze.com/admin/conversations/rsr-release-3-dot-22-chisinau-is-out
Assignee: Unassigned

Message:
Hi RSR Team,

Just saw this email, nice that the new release is already out! However, I tried to use the search function, and it shows organizations that are not related to the Akvo Page, in this case the EUTF Page. Randomly searching for “Tom(bouctou)” gives the following search options. Clicking on the first organization “Catholic Diocese of Tombu", it leads you nowhere..

Please see image below.

Thanks!
Christien

Christien Bosman
Project Officer

Akvo • 's-Gravenhekje 1A • 1011 TG • Amsterdam (NL)
T +31 20 8200 175 • M +31 6 1191 5449 • S christien.bosman • I www.akvo.org &lt;http://www.akvo.org/&gt;


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `akvo/rest/views/typeahead.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 """Akvo RSR is covered by the GNU Affero General Public License.
4 See more details in the license.txt file located at the root folder of the
5 Akvo RSR module. For additional details on the GNU license please
6 see < http://www.gnu.org/licenses/agpl.html >.
7 """
8 
9 from akvo.rest.serializers import (TypeaheadCountrySerializer,
10                                    TypeaheadOrganisationSerializer,
11                                    TypeaheadProjectSerializer,
12                                    TypeaheadProjectUpdateSerializer)
13 
14 from akvo.codelists.models import Country, Version
15 from akvo.rsr.models import Organisation, Project, ProjectUpdate
16 from akvo.rsr.views.project import _project_directory_coll
17 
18 from django.conf import settings
19 
20 from rest_framework.decorators import api_view
21 from rest_framework.response import Response
22 
23 
24 def rejig(queryset, serializer):
25     """Rearrange & add queryset count to the response data."""
26     return {
27         'count': queryset.count(),
28         'results': serializer.data
29     }
30 
31 
32 @api_view(['GET'])
33 def typeahead_country(request):
34     iati_version = Version.objects.get(code=settings.IATI_VERSION)
35     countries = Country.objects.filter(version=iati_version)
36     return Response(
37         rejig(countries, TypeaheadCountrySerializer(countries, many=True))
38     )
39 
40 
41 @api_view(['GET'])
42 def typeahead_organisation(request):
43     organisations = Organisation.objects.all()
44     return Response(
45         rejig(organisations, TypeaheadOrganisationSerializer(organisations,
46                                                              many=True))
47     )
48 
49 
50 @api_view(['GET'])
51 def typeahead_user_organisations(request):
52     user = request.user
53     is_admin = user.is_active and (user.is_superuser or user.is_admin)
54     organisations = user.approved_organisations() if not is_admin else Organisation.objects.all()
55     return Response(
56         rejig(organisations, TypeaheadOrganisationSerializer(organisations,
57                                                              many=True))
58     )
59 
60 
61 @api_view(['GET'])
62 def typeahead_project(request):
63     """Return the typeaheads for projects.
64 
65     Without any query parameters, it returns the info for all the projects in
66     the current context -- changes depending on whether we are on a partner
67     site, or the RSR site.
68 
69     If a published query parameter is passed, only projects that have been
70     published are returned.
71 
72     NOTE: The unauthenticated user gets information about all the projects when
73     using this API endpoint.  More permission checking will need to be added,
74     if the amount of data being returned is changed.
75 
76     """
77     if request.GET.get('published', '0') == '0':
78         # Project editor - organization projects, all
79         page = request.rsr_page
80         projects = page.organisation.all_projects() if page else Project.objects.all()
81     else:
82         # Search bar - organization projects, published
83         projects = _project_directory_coll(request)
84 
85     projects = projects.exclude(title='')
86     return Response(
87         rejig(projects, TypeaheadProjectSerializer(projects, many=True))
88     )
89 
90 
91 @api_view(['GET'])
92 def typeahead_user_projects(request):
93     user = request.user
94     is_admin = user.is_active and (user.is_superuser or user.is_admin)
95     if is_admin:
96         projects = Project.objects.all()
97     else:
98         projects = user.approved_organisations().all_projects()
99     projects = projects.exclude(title='')
100     return Response(
101         rejig(projects, TypeaheadProjectSerializer(projects, many=True))
102     )
103 
104 
105 @api_view(['GET'])
106 def typeahead_impact_projects(request):
107     user = request.user
108     projects = Project.objects.all() if user.is_admin or user.is_superuser else user.my_projects()
109     projects = projects.published().filter(is_impact_project=True).order_by('title')
110 
111     return Response(
112         rejig(projects, TypeaheadProjectSerializer(projects, many=True))
113     )
114 
115 
116 @api_view(['GET'])
117 def typeahead_projectupdate(request):
118     updates = ProjectUpdate.objects.all()
119     return Response(
120         rejig(updates, TypeaheadProjectUpdateSerializer(updates, many=True))
121     )
122
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/akvo/rest/views/typeahead.py b/akvo/rest/views/typeahead.py
--- a/akvo/rest/views/typeahead.py
+++ b/akvo/rest/views/typeahead.py
@@ -40,7 +40,8 @@
 
 @api_view(['GET'])
 def typeahead_organisation(request):
-    organisations = Organisation.objects.all()
+    page = request.rsr_page
+    organisations = page.organisation.partners().distinct() if page else Organisation.objects.all()
     return Response(
         rejig(organisations, TypeaheadOrganisationSerializer(organisations,
                                                              many=True))

{"golden_diff": "diff --git a/akvo/rest/views/typeahead.py b/akvo/rest/views/typeahead.py\n--- a/akvo/rest/views/typeahead.py\n+++ b/akvo/rest/views/typeahead.py\n@@ -40,7 +40,8 @@\n \n @api_view(['GET'])\n def typeahead_organisation(request):\n-    organisations = Organisation.objects.all()\n+    page = request.rsr_page\n+    organisations = page.organisation.partners().distinct() if page else Organisation.objects.all()\n     return Response(\n         rejig(organisations, TypeaheadOrganisationSerializer(organisations,\n                                                              many=True))\n", "issue": "non-EUTF search results appearing (estimate: 8)\nCreated via Reamaze:\r\n\r\nLink: https://akvoo.reamaze.com/admin/conversations/rsr-release-3-dot-22-chisinau-is-out\r\nAssignee: Unassigned\r\n\r\nMessage:\r\nHi RSR Team,\r\n\r\nJust saw this email, nice that the new release is already out! However, I tried to use the search function, and it shows organizations that are not related to the Akvo Page, in this case the EUTF Page. Randomly searching for \u201cTom(bouctou)\u201d gives the following search options. Clicking on the first organization \u201cCatholic Diocese of Tombu\", it leads you nowhere..\r\n\r\nPlease see image below.\r\n\r\nThanks!\r\nChristien\r\n\r\nChristien Bosman\r\nProject Officer\r\n\r\nAkvo \u2022 's-Gravenhekje 1A \u2022 1011 TG \u2022 Amsterdam (NL)\r\nT +31 20 8200 175 \u2022 M +31 6 1191 5449 \u2022 S christien.bosman \u2022 I www.akvo.org &lt;http://www.akvo.org/&gt;\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\nSee more details in the license.txt file located at the root folder of the\nAkvo RSR module. For additional details on the GNU license please\nsee < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom akvo.rest.serializers import (TypeaheadCountrySerializer,\n                                   TypeaheadOrganisationSerializer,\n                                   TypeaheadProjectSerializer,\n                                   TypeaheadProjectUpdateSerializer)\n\nfrom akvo.codelists.models import Country, Version\nfrom akvo.rsr.models import Organisation, Project, ProjectUpdate\nfrom akvo.rsr.views.project import _project_directory_coll\n\nfrom django.conf import settings\n\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\n\n\ndef rejig(queryset, serializer):\n    \"\"\"Rearrange & add queryset count to the response data.\"\"\"\n    return {\n        'count': queryset.count(),\n        'results': serializer.data\n    }\n\n\n@api_view(['GET'])\ndef typeahead_country(request):\n    iati_version = Version.objects.get(code=settings.IATI_VERSION)\n    countries = Country.objects.filter(version=iati_version)\n    return Response(\n        rejig(countries, TypeaheadCountrySerializer(countries, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_organisation(request):\n    organisations = Organisation.objects.all()\n    return Response(\n        rejig(organisations, TypeaheadOrganisationSerializer(organisations,\n                                                             many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_user_organisations(request):\n    user = request.user\n    is_admin = user.is_active and (user.is_superuser or user.is_admin)\n    organisations = user.approved_organisations() if not is_admin else Organisation.objects.all()\n    return Response(\n        rejig(organisations, TypeaheadOrganisationSerializer(organisations,\n                                                             many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_project(request):\n    \"\"\"Return the typeaheads for projects.\n\n    Without any query parameters, it returns the info for all the projects in\n    the current context -- changes depending on whether we are on a partner\n    site, or the RSR site.\n\n    If a published query parameter is passed, only projects that have been\n    published are returned.\n\n    NOTE: The unauthenticated user gets information about all the projects when\n    using this API endpoint.  More permission checking will need to be added,\n    if the amount of data being returned is changed.\n\n    \"\"\"\n    if request.GET.get('published', '0') == '0':\n        # Project editor - organization projects, all\n        page = request.rsr_page\n        projects = page.organisation.all_projects() if page else Project.objects.all()\n    else:\n        # Search bar - organization projects, published\n        projects = _project_directory_coll(request)\n\n    projects = projects.exclude(title='')\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_user_projects(request):\n    user = request.user\n    is_admin = user.is_active and (user.is_superuser or user.is_admin)\n    if is_admin:\n        projects = Project.objects.all()\n    else:\n        projects = user.approved_organisations().all_projects()\n    projects = projects.exclude(title='')\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_impact_projects(request):\n    user = request.user\n    projects = Project.objects.all() if user.is_admin or user.is_superuser else user.my_projects()\n    projects = projects.published().filter(is_impact_project=True).order_by('title')\n\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_projectupdate(request):\n    updates = ProjectUpdate.objects.all()\n    return Response(\n        rejig(updates, TypeaheadProjectUpdateSerializer(updates, many=True))\n    )\n", "path": "akvo/rest/views/typeahead.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\nSee more details in the license.txt file located at the root folder of the\nAkvo RSR module. For additional details on the GNU license please\nsee < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom akvo.rest.serializers import (TypeaheadCountrySerializer,\n                                   TypeaheadOrganisationSerializer,\n                                   TypeaheadProjectSerializer,\n                                   TypeaheadProjectUpdateSerializer)\n\nfrom akvo.codelists.models import Country, Version\nfrom akvo.rsr.models import Organisation, Project, ProjectUpdate\nfrom akvo.rsr.views.project import _project_directory_coll\n\nfrom django.conf import settings\n\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\n\n\ndef rejig(queryset, serializer):\n    \"\"\"Rearrange & add queryset count to the response data.\"\"\"\n    return {\n        'count': queryset.count(),\n        'results': serializer.data\n    }\n\n\n@api_view(['GET'])\ndef typeahead_country(request):\n    iati_version = Version.objects.get(code=settings.IATI_VERSION)\n    countries = Country.objects.filter(version=iati_version)\n    return Response(\n        rejig(countries, TypeaheadCountrySerializer(countries, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_organisation(request):\n    page = request.rsr_page\n    organisations = page.organisation.partners().distinct() if page else Organisation.objects.all()\n    return Response(\n        rejig(organisations, TypeaheadOrganisationSerializer(organisations,\n                                                             many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_user_organisations(request):\n    user = request.user\n    is_admin = user.is_active and (user.is_superuser or user.is_admin)\n    organisations = user.approved_organisations() if not is_admin else Organisation.objects.all()\n    return Response(\n        rejig(organisations, TypeaheadOrganisationSerializer(organisations,\n                                                             many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_project(request):\n    \"\"\"Return the typeaheads for projects.\n\n    Without any query parameters, it returns the info for all the projects in\n    the current context -- changes depending on whether we are on a partner\n    site, or the RSR site.\n\n    If a published query parameter is passed, only projects that have been\n    published are returned.\n\n    NOTE: The unauthenticated user gets information about all the projects when\n    using this API endpoint.  More permission checking will need to be added,\n    if the amount of data being returned is changed.\n\n    \"\"\"\n    if request.GET.get('published', '0') == '0':\n        # Project editor - organization projects, all\n        page = request.rsr_page\n        projects = page.organisation.all_projects() if page else Project.objects.all()\n    else:\n        # Search bar - organization projects, published\n        projects = _project_directory_coll(request)\n\n    projects = projects.exclude(title='')\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_user_projects(request):\n    user = request.user\n    is_admin = user.is_active and (user.is_superuser or user.is_admin)\n    if is_admin:\n        projects = Project.objects.all()\n    else:\n        projects = user.approved_organisations().all_projects()\n    projects = projects.exclude(title='')\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_impact_projects(request):\n    user = request.user\n    projects = Project.objects.all() if user.is_admin or user.is_superuser else user.my_projects()\n    projects = projects.published().filter(is_impact_project=True).order_by('title')\n\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_projectupdate(request):\n    updates = ProjectUpdate.objects.all()\n    return Response(\n        rejig(updates, TypeaheadProjectUpdateSerializer(updates, many=True))\n    )\n", "path": "akvo/rest/views/typeahead.py"}]}