From 519ab28c3f1adc0b9ac803fa837110f9d173e979 Mon Sep 17 00:00:00 2001 From: Phie Date: Thu, 17 Sep 2020 22:57:44 +0200 Subject: index low case text for faster search --- appinfo/database.xml | 6 +++++- lib/Controller/NoteController.php | 24 ++++++++++++----------- lib/Hooks/FSHooks.php | 2 +- lib/Misc/CacheManager.php | 41 ++++++++++++++++++++++++++++----------- lib/Misc/NoteUtils.php | 27 +++++++++++++++++++------- lib/Misc/Search.php | 16 ++++++--------- 6 files changed, 75 insertions(+), 41 deletions(-) diff --git a/appinfo/database.xml b/appinfo/database.xml index f78acf7..03f676b 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -30,7 +30,11 @@ last_modification_file integer - + + low_case_text + text + 10000000 + \ No newline at end of file diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index ee1598b..cb4b3cf 100755 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -602,7 +602,7 @@ public function getOpusEncoder(){ try{ $meta = $utils->getMetadata($this->CarnetFolder, $path); $array[$path] = $meta; - $cache->addToCache($path, $meta, $meta['lastmodfile']); + $cache->addToCache($path, $meta, $meta['lastmodfile'], $meta['text']); } catch(\PhpZip\Exception\ZipException $e){ } @@ -722,10 +722,10 @@ public function getOpusEncoder(){ } - - $meta['shorttext'] = NoteUtils::getShortTextFromHTML($_POST['html']); + $text = NoteUtils::getTextFromHTML($_POST['html']); + $meta['shorttext'] = NoteUtils::getShortText($text); $meta['metadata'] = json_decode($_POST['metadata']); - $cache->addToCache($path, $meta, $mtime); + $cache->addToCache($path, $meta, $mtime, $text); } @@ -803,10 +803,10 @@ public function getOpusEncoder(){ if($mtime !== false){ //we need to refresh cache $cache = new CacheManager($this->db, $this->CarnetFolder); - $cached = $cache->getFromCache(array(0=>$path)); + $cached = $cache->getFromCache2(array(0=>$path), true); $meta = array(); if(isset($cached[$path])){ - $meta = $cached[$path]; + $meta = $cached[$path]['metadata']; } if(isset($preview)){ if(isset($meta['previews'])){ @@ -822,7 +822,7 @@ public function getOpusEncoder(){ unset($meta['previews'][$key]); } } - $cache->addToCache($path, $meta, $mtime); + $cache->addToCache($path, $meta, $mtime, $cached['low_case_text']); } return $this->listMediaOfOpenNote($id); @@ -911,7 +911,8 @@ public function getOpusEncoder(){ if(isset($cached[$path])){ $meta = $cached[$path]; } - $meta['shorttext'] = NoteUtils::getShortTextFromHTML($_POST['html']); + $text = NoteUtils::getTextFromHTML($_POST['html']); + $meta['shorttext'] = NoteUtils::getShortText($text); $meta['metadata'] = json_decode($_POST['metadata']); if(isset($preview)){ if(!isset($meta['previews'])) @@ -923,7 +924,7 @@ public function getOpusEncoder(){ $meta['media'] = array(); if(!in_array($meta['media'],$media)) array_push($meta['media'],$media); - $cache->addToCache($path, $meta, $mtime); + $cache->addToCache($path, $meta, $mtime, $text); } return $this->listMediaOfOpenNote($id); @@ -1001,10 +1002,11 @@ public function getOpusEncoder(){ // Do not close $tmph, it is closed by putContent, and a log is displayed as // fclose can not work //fclose($tmph); + $text = NoteUtils::getTextFromHTML($folder->get("index.html")->getContent()); $meta['metadata'] = json_decode($folder->get("metadata.json")->getContent()); - $meta['shorttext'] = NoteUtils::getShortTextFromHTML($folder->get("index.html")->getContent()); + $meta['shorttext'] = NoteUtils::getShortText($text); $cache = new CacheManager($this->db, $this->CarnetFolder); - $cache->addToCache($path, $meta, $file->getFileInfo()->getMtime()); + $cache->addToCache($path, $meta, $file->getFileInfo()->getMtime(), $text); } else throw new Exception('Unable to create Zip'); diff --git a/lib/Hooks/FSHooks.php b/lib/Hooks/FSHooks.php index d2b1f90..b7a2251 100644 --- a/lib/Hooks/FSHooks.php +++ b/lib/Hooks/FSHooks.php @@ -82,7 +82,7 @@ class FSHooks { $cacheManager = new CacheManager($this->db, $this->carnetFolder); $utils = new NoteUtils(); $metadata = $utils->getMetadata($this->carnetFolder, $relativePath); - $cacheManager->addToCache($relativePath, $metadata, $metadata['lastmodfile']); + $cacheManager->addToCache($relativePath, $metadata, $metadata['lastmodfile'], $metadata['text']); } catch(\PhpZip\Exception\ZipException $e){ } diff --git a/lib/Misc/CacheManager.php b/lib/Misc/CacheManager.php index 3fe904e..045421d 100644 --- a/lib/Misc/CacheManager.php +++ b/lib/Misc/CacheManager.php @@ -11,27 +11,33 @@ class CacheManager{ $this->carnetFolder = $carnetFolder; } - public function addToCache($relativePath, $metadata, $lastmodfile){ - $this->addToCacheFullPath($this->carnetFolder->getFullPath($relativePath), $metadata, $lastmodfile); + public function addToCache($relativePath, $metadata, $lastmodfile, $text){ + $this->addToCacheFullPath($this->carnetFolder->getFullPath($relativePath), $metadata, $lastmodfile, $low_case_text); } - public function addToCacheFullPath($fullPath, $metadata, $lastmodfile){ - $sql = 'INSERT into `*PREFIX*carnet_metadata` VALUES(?, ?, ?)'; + public function addToCacheFullPath($fullPath, $metadata, $lastmodfile, $text){ + if(isset($metadata['text'])) + unset($metadata['text']); + $low_case_text = strtolower(NoteUtils::removeAccents($text)); + $sql = 'INSERT into `*PREFIX*carnet_metadata` VALUES(?, ?, ?, ?)'; $stmt = $this->db->prepare($sql); $stmt->bindParam(1, $fullPath, \PDO::PARAM_STR); if(!is_string($metadata)) $metadata = json_encode($metadata); $stmt->bindParam(2, $metadata, \PDO::PARAM_STR); $stmt->bindParam(3, $lastmodfile, \PDO::PARAM_INT); + $stmt->bindParam(4, $low_case_text, \PDO::PARAM_STR); + try{ $stmt->execute(); } catch(\Doctrine\DBAL\Exception\UniqueConstraintViolationException $ex){ - $sql = 'UPDATE `*PREFIX*carnet_metadata` SET `metadata` = ?, `last_modification_file` = ? WHERE `path` = ?'; + $sql = 'UPDATE `*PREFIX*carnet_metadata` SET `metadata` = ?, `last_modification_file` = ?, `low_case_text` = ? WHERE `path` = ?'; $stmt = $this->db->prepare($sql); $stmt->bindParam(1, $metadata, \PDO::PARAM_STR); - $stmt->bindParam(3, $fullPath, \PDO::PARAM_STR); $stmt->bindParam(2, $lastmodfile, \PDO::PARAM_INT); + $stmt->bindParam(3, $low_case_text, \PDO::PARAM_STR); + $stmt->bindParam(4, $fullPath, \PDO::PARAM_STR); $stmt->execute(); } @@ -82,7 +88,8 @@ class CacheManager{ if(substr($relativePath, 0, 1) === "/") $relativePath = substr($relativePath, 1); $meta = $utils->getMetadata($carnetFolder, $relativePath); - $this->addToCacheFullPath($node->getPath(), $meta, $meta['lastmodfile']); + $text = $meta['text']; + $this->addToCacheFullPath($node->getPath(), $meta, $meta['lastmodfile'], $text); } catch(\PhpZip\Exception\ZipException $e){ } catch(\OCP\Encryption\Exceptions\GenericEncryptionException $e){ @@ -100,8 +107,11 @@ class CacheManager{ $stmt->execute(); } - public function getFromCache($arrayRelativePath){ + return $this->getFromCache2($arrayRelativePath, false); + } + + public function getFromCache2($arrayRelativePath, $withLowCaseText){ $total = 0; $array = array(); @@ -125,7 +135,15 @@ class CacheManager{ $stmt->execute($arrayFullPath); $fetched = $stmt->fetchAll(); foreach ($fetched as $row){ - $array[substr($row['path'], strlen($this->carnetFolder->getPath())+1)] = json_decode($row['metadata'], true); + $metadata = json_decode($row['metadata'], true); + $item = array(); + if(!$withLowCaseText){ + $item = $metadata; + } else { + $item['metadata'] = $metadata; + $item['low_case_text'] = $row['low_case_text']; + } + $array[substr($row['path'], strlen($this->carnetFolder->getPath())+1)] = $item; } $stmt->closeCursor(); @@ -136,11 +154,12 @@ class CacheManager{ public function search($query){ $arrayFullPath = array(); $sql = 'SELECT * FROM `*PREFIX*carnet_metadata` ' . - 'WHERE path LIKE ? AND metadata LIKE ? '; + 'WHERE path LIKE ? AND (metadata LIKE ? OR low_case_text LIKE ?)'; $args = array(); array_push($args, $this->carnetFolder->getPath()."/%"); - array_push($args, "%".$query."%"); + array_push($args, "%".$query."%"); + $stmt = $this->db->prepare($sql); $stmt->execute($args); $array = array(); diff --git a/lib/Misc/NoteUtils.php b/lib/Misc/NoteUtils.php index f9231c0..9c3b244 100644 --- a/lib/Misc/NoteUtils.php +++ b/lib/Misc/NoteUtils.php @@ -2,8 +2,8 @@ namespace OCA\Carnet\Misc; class NoteUtils{ public static $defaultCarnetNotePath = "Documents/QuickNote"; - public static function getShortTextFromHTML($html){ //not optimized at alllll.... - return mb_substr( + public static function getTextFromHTML($html){ //not optimized at alllll.... + return //remove first and last br preg_replace('/^()*|()*$/i', '', //multiple to single br @@ -18,8 +18,18 @@ class NoteUtils{ preg_replace('/()/', '[linebr]', //all div to [linebr] preg_replace("/
(.*?)<\/div>/", "[linebr]$1",$html) - )))))),0, 150); + )))))); } + public static function getShortText($text){ //not optimized at alllll.... + return mb_substr($text, 0, 150); + } + + public static function removeAccents($str) { + $a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 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 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o', 'Α', 'α', 'Ε', 'ε', 'Ο', 'ο', 'Ω', 'ω', 'Ι', 'ι', 'ι', 'ι', 'Υ', 'υ', 'υ', 'υ', 'Η', 'η'); + return str_replace($a, $b, $str); + } + public function getMetadata($carnetFolder, $path){ $meta = array(); $node = $carnetFolder->get($path); @@ -31,8 +41,10 @@ class NoteUtils{ } try{ - - $meta['shorttext'] = self::getShortTextFromHTML($node->get('index.html')->getContent()); + $text = self::getTextFromHTML($node->get('index.html')->getContent()); + + $meta['shorttext'] = self::getShortText($text); + $meta['text'] = $text; $meta['media'] = array(); $meta['previews'] = array(); @@ -67,8 +79,9 @@ class NoteUtils{ } try{ - - $meta['shorttext'] = self::getShortTextFromHTML($zipFile->getEntryContents("index.html")); + $text = self::getTextFromHTML($zipFile->getEntryContents("index.html")); + $meta['shorttext'] = self::getShortText($text); + $meta['lower_case_text'] = strtolower(self::removeAccents($text)); $meta['media'] = array(); $meta['previews'] = array(); diff --git a/lib/Misc/Search.php b/lib/Misc/Search.php index 3ee11a0..8d4c7c0 100644 --- a/lib/Misc/Search.php +++ b/lib/Misc/Search.php @@ -6,6 +6,8 @@ use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCA\Carnet\Misc\CacheManager; +use OCA\Carnet\Misc\NoteUtils; + use OCP\IDBConnection; class Search { @@ -40,15 +42,9 @@ public function __construct($AppName, $RootFolder, $Config, IDBConnection $IDBC } } -protected function removeAccents($str) { - $a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', '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'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o', 'Α', 'α', 'Ε', 'ε', 'Ο', 'ο', 'Ω', 'ω', 'Ι', 'ι', 'ι', 'ι', 'Υ', 'υ', 'υ', 'υ', 'Η', 'η'); - return str_replace($a, $b, $str); -} - public function startSearch($query, $from) { - $query = $this->removeAccents($query); + $query = NoteUtils::removeAccents($query); $query = strtolower($query); $this->data = array(); $this->startTime = time(); @@ -121,7 +117,7 @@ private function search($relativePath, $folder, $query, $curDepth){ if(in_array($relativePath.$in->getName(), $this->pathArray)){ continue; } - if(strstr(strtolower($this->removeAccents($in->getName())), $query)){ + if(strstr(strtolower(NoteUtils::removeAccents($in->getName())), $query)){ $this->writeFound($relativePath, $in); continue; } @@ -135,7 +131,7 @@ private function search($relativePath, $folder, $query, $curDepth){ if (is_object ($metadata)) { foreach($metadata->keywords as $keyword){ - if(strstr($this->removeAccents(strtolower($keyword)), $query)){ + if(strstr(NoteUtils::removeAccents(strtolower($keyword)), $query)){ $this->writeFound($relativePath,$in); $hasFound = true; break; @@ -149,7 +145,7 @@ private function search($relativePath, $folder, $query, $curDepth){ } catch(Exception $e){ } $index = $zipFile->getEntryContents("index.html"); - if(trim ($query) !== "" && strstr(strtolower($this->removeAccents($index)), $query)){ + if(trim ($query) !== "" && strstr(strtolower(NoteUtils::removeAccents($index)), $query)){ $this->writeFound($relativePath,$in); } } catch(\OCP\Files\NotFoundException $e) { -- cgit v1.2.3