Lines Matching +full:continue +full:- +full:on +full:- +full:error

11  * Class that encapsulates operations on the indexer database.
37 if (!$this->lock())
41 $pid = $this->getPIDNoLock($page);
43 $this->unlock();
49 $words = $this->getPageWords($text);
51 $this->unlock();
57 $index = $this->getIndex('i', $wlen);
60 $index[$wid] = $this->updateTuple($idx, $pid, $freq);
63 if (!$this->saveIndex('i', $wlen, $index)) {
64 $this->unlock();
71 $pageword_idx = $this->getIndexKey('pageword', '', $pid);
84 $index = $this->getIndex('i', $wlen);
86 $index[$wid] = $this->updateTuple($index[$wid], $pid, 0);
88 $this->saveIndex('i', $wlen, $index);
93 if (!$this->saveIndexKey('pageword', '', $pid, $pageword_idx)) {
94 $this->unlock();
98 $this->unlock();
115 $tokens = $this->tokenizer($text);
131 $word_idx = $this->getIndex('w', $wlen);
146 if ($word_idx_modified && !$this->saveIndex('w', $wlen, $word_idx))
167 * @author Michael Hamann <michael@content-space.de>
178 if (!$this->lock())
182 $pid = $this->getPIDNoLock($page);
184 $this->unlock();
194 $this->saveIndexKey('title', '', $pid, $value);
200 $this->addIndexKey('metadata', '', $metaname);
201 $metaidx = $this->getIndex($metaname . '_i', '');
202 $metawords = $this->getIndex($metaname . '_w', '');
207 $val_idx = $this->getIndexKey($metaname . '_p', '', $pid);
210 // -1 means remove, 0 keep, 1 add
211 $val_idx = array_combine($val_idx, array_fill(0, count($val_idx), -1));
237 $this->saveIndex($metaname . '_w', '', $metawords);
241 if ($action == -1) {
242 $metaidx[$id] = $this->updateTuple($metaidx[$id], $pid, 0);
246 $metaidx[$id] = $this->updateTuple($metaidx[$id], $pid, 1);
252 $this->saveIndex($metaname . '_i', '', $metaidx);
254 $this->saveIndexKey($metaname . '_p', '', $pid, $val_idx);
261 $this->unlock();
267 …* old or new name exists in the filesystem. It returns an error if the old page isn't in the page …
272 … @return string|bool If the page was successfully renamed, can be a message in the case of an error
276 if (!$this->lock()) return 'locked';
278 $pages = $this->getPages();
282 $this->unlock();
289 if (!$this->deletePageNoLock($newpage)) {
299 if (!$this->saveIndex('page', '', $pages)) {
300 $this->unlock();
305 $this->pidCache = [];
307 $this->unlock();
318 …return bool|string If renaming the value has been successful, false or error message on error.
322 if (!$this->lock()) return 'locked';
325 $metavalues = $this->getIndex($key, '_w');
334 $indexline = $this->getIndexKey($key . '_i', '', $oldid);
336 $newindexline = $this->getIndexKey($key . '_i', '', $newid);
337 $pagekeys = $this->getIndex($key . '_p', '');
341 $newindexline = $this->updateTuple($newindexline, $id, $count);
352 $this->saveIndex($key . '_p', '', $pagekeys);
354 $this->saveIndexKey($key . '_i', '', $oldid, '');
355 $this->saveIndexKey($key . '_i', '', $newid, $newindexline);
359 if (!$this->saveIndex($key . '_w', '', $metavalues)) {
360 $this->unlock();
366 $this->unlock();
382 if (!$this->lock())
385 $result = $this->deletePageNoLock($page);
387 $this->unlock();
405 $pid = $this->getPIDNoLock($page);
411 $pageword_idx = $this->getIndexKey('pageword', '', $pid);
423 $index = $this->getIndex('i', $wlen);
425 $index[$wid] = $this->updateTuple($index[$wid], $pid, 0);
427 $this->saveIndex('i', $wlen, $index);
431 if (!$this->saveIndexKey('pageword', '', $pid, "")) {
435 $this->saveIndexKey('title', '', $pid, "");
436 $keyidx = $this->getIndex('metadata', '');
438 $val_idx = explode(':', $this->getIndexKey($metaname . '_p', '', $pid));
439 $meta_idx = $this->getIndex($metaname . '_i', '');
441 if ($id === '') continue;
442 $meta_idx[$id] = $this->updateTuple($meta_idx[$id], $pid, 0);
444 $this->saveIndex($metaname . '_i', '', $meta_idx);
445 $this->saveIndexKey($metaname . '_p', '', $pid, '');
460 if (!$this->lock()) return false;
483 $this->pidCache = [];
485 $this->unlock();
512 if ($evt->advise_before(true)) {
513 if (preg_match('/[^0-9A-Za-z ]/u', $text)) {
517 $evt->advise_after();
524 if (preg_match('/[^0-9A-Za-z ]/u', $text))
525 $text = Clean::stripspecials($text, ' ', '\._\-:' . $wc);
529 $wordlist[$i] = (preg_match('/[^0-9A-Za-z]/u', $word)) ?
547 * @return bool|int The page id on success, false on error
552 if (isset($this->pidCache[$page])) return $this->pidCache[$page];
554 if (!$this->lock())
558 $pid = $this->getPIDNoLock($page);
560 $this->unlock();
564 $this->unlock();
573 * @return bool|int The page id on success, false on error
578 if (isset($this->pidCache[$page])) return $this->pidCache[$page];
579 $pid = $this->addIndexKey('page', '', $page);
582 if (count($this->pidCache) > 10) array_shift($this->pidCache);
583 $this->pidCache[$page] = $pid;
595 return $this->getIndexKey('page', '', $pid);
601 * The search words must be pre-tokenized, meaning only letters and
606 * number of times that token appears on the page as value.
617 $wids = $this->getIndexWords($tokens, $result);
620 $page_idx = $this->getIndex('page', '');
624 $index = $this->getIndex('i', $wlen);
627 $docs["$wlen*$ixid"] = $this->parseTuples($page_idx, $index[$ixid]);
637 if (!isset($docs[$wid])) continue;
641 if (!page_exists($hitkey, '', false)) continue;
654 * The metadata values are compared as case-sensitive strings. Pass a
667 * @author Michael Hamann <michael@content-space.de>
682 $words = $this->getIndex('title', '');
684 $words = $this->getIndex($metaname . '_w', '');
705 $xval = substr($xval, 0, -1);
726 $page_idx = $this->getIndex('page', '');
738 $lines = $this->getIndex($metaname . '_i', '');
741 // parse the tuples of the form page_id*1:page2_id*1 and so on, return value
743 $pages = array_keys($this->parseTuples($page_idx, $lines[$value_id]));
783 --$wlen;
786 $xword = substr($xword, 0, -1);
788 --$wlen;
791 continue;
808 $indexes_known = $this->indexLengths($length_filter);
813 $word_idx = $this->getIndex('w', $ixlen);
829 if (is_null($w[1])) continue;
851 $page_idx = $this->getIndex('page', '');
858 $title_idx = $this->getIndex('title', '');
866 $lines = $this->getIndex($metaname . '_i', '');
868 $pages = array_merge($pages, $this->parseTuples($page_idx, $line));
894 $index = $this->getIndex('title', '');
902 $index = $this->getIndex($metaname . '_i', '');
905 $freq = $this->countTuples($line);
910 $words = $this->getIndex($metaname . '_w', '');
919 if ($length < $minlen) continue;
920 $index = $this->getIndex('i', $length);
923 $freq = $this->countTuples($line);
926 $words = $this->getIndex('w', $length);
952 if (is_dir($lock) && time() - @filemtime($lock) > 60 * 5) {
953 // looks like a stale lock - remove it
1049 $ln = -1;
1078 $ln = -1;
1089 $ln = -1;
1113 $index = $this->getIndex($idx, $suffix);
1118 if (!$this->saveIndex($idx, $suffix, $index)) {
1215 if ($tuple === '') continue;
1217 if (!$cnt) continue;
1220 if ($key === false || is_null($key)) continue;
1240 if ($tuple === '') continue;