diff --git a/ckanext/odsh/controller.py b/ckanext/odsh/controller.py
index 906afa0c6537fd6f5cc9bd6740631c5c9d2928d1..ac2c6d1fdd7c8f3c295b871d6fb944b0687bba31 100644
--- a/ckanext/odsh/controller.py
+++ b/ckanext/odsh/controller.py
@@ -166,10 +166,9 @@ class OdshFeedController(FeedController):
 
 
 class OdshAutocompleteController(ApiController):
-    def autocomplete(self):
-        from ckan.common import request
+    def autocomplete(self, q):
         query = {
-            'spellcheck.q': request.get('q', ''),
+            'spellcheck.q': q,
             'wt': 'json'}
 
         conn = make_connection(decode_dates=False)
diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py
index 4f310eda199171a906dfd7ca3b14672e09cb5752..bb777f65261353b60bdf0ed00b3281ef3980bba3 100644
--- a/ckanext/odsh/plugin.py
+++ b/ckanext/odsh/plugin.py
@@ -89,7 +89,7 @@ class OdshAutocompletePlugin(plugins.SingletonPlugin):
 
     def before_map(self, map):
         controller = 'ckanext.odsh.controller:OdshAutocompleteController'
-        map.connect('/autocomplete', controller=controller, action='autocomplete')
+        map.connect('/autocomplete?q={q}', controller=controller, action='autocomplete')
         return map