9 * @author Christian Weiske <cweiske@cweiske.de>
10 * @copyright 2014 Christian Weiske
11 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
12 * @link http://cweiske.de/grauphel.htm
14 namespace OCA\Grauphel\Search;
16 use \OCA\Grauphel\Lib\NoteStorage;
19 * Hook for the site-wide owncloud search.
23 * @author Christian Weiske <cweiske@cweiske.de>
24 * @copyright 2014 Christian Weiske
25 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
26 * @version Release: @package_version@
27 * @link http://cweiske.de/grauphel.htm
29 class Provider extends \OCP\Search\Provider
34 * @param string $query
36 * @return array list of \OCA\Grauphel\Search\Note
38 public function search($query)
40 $urlGen = \OC::$server->getURLGenerator();
41 $notes = new NoteStorage($urlGen);
43 \OC::$server->getUserSession()->getUser()->getUID()
46 $qp = new QueryParser();
47 $rows = $notes->search($qp->parse($query));
50 foreach ($rows as $row) {
52 $res->id = $row['note_guid'];
53 $res->name = htmlspecialchars_decode($row['note_title']);
54 $res->link = $urlGen->linkToRoute(
55 'grauphel.gui.note', array('guid' => $row['note_guid'])