+def __plugin_search(text):
+ """
+ Runs registered plugins to search for results
+ """
+
+ hits = []
+ for label, search_func in plugin._SEARCH_FUNCTIONS.items():
+ result = search_func(text)
+ if result is not None:
+ hits.extend(result)
+
+ n = len(hits)
+ if n == 0:
+ msg = 'No hits found for: %s' % (text)
+ return report_error(msg)
+ elif n == 1:
+ return redirect_to_url(hits[0][1])
+ else:
+ msg = "%d hits found for (%s); multi-hit not implemented yet." % (n, text)
+ return report_error(msg)
+
+
+ #return json.dumps(hits)
+
+