Lines Matching defs:index

23      * Adds the contents of a page to the fulltext index
57 $index = $this->getIndex('i', $wlen);
59 $idx = ($wid < count($index)) ? $index[$wid] : '';
60 $index[$wid] = $this->updateTuple($idx, $pid, $freq);
63 if (!$this->saveIndex('i', $wlen, $index)) {
70 // Remove obsolete index entries
84 $index = $this->getIndex('i', $wlen);
86 $index[$wid] = $this->updateTuple($index[$wid], $pid, 0);
88 $this->saveIndex('i', $wlen, $index);
91 // Save the reverse index
103 * Split the words in a page and add them to the index.
129 $index = []; //resulting index
141 if (!isset($index[$wlen]))
142 $index[$wlen] = [];
143 $index[$wlen][$wid] = $freq;
145 // save back the word index
150 return $index;
154 * Add/update keys to/of the metadata index.
188 // Special handling for titles so the index file is simpler
227 // test if value is already in the index
266 * Rename a page in the search index without changing the indexed content. This function doesn't check if the
283 return 'page is not in index';
288 // make sure the page is not in the index anymore
298 // update index
312 * Renames a meta value in the index. This doesn't change the meta value in the pages, it assumes that all pages
324 // change the relation references index
371 * Remove a page from the index
393 * Remove a page from the index without locking the index, only use this function if the index is already locked
410 // Remove obsolete index entries
423 $index = $this->getIndex('i', $wlen);
425 $index[$wid] = $this->updateTuple($index[$wid], $pid, 0);
427 $this->saveIndex('i', $wlen, $index);
430 // Save the reverse index
452 * Clear the whole index
454 * @return bool If the index has been cleared successfully
569 * Get the numeric PID of a page without locking the index.
570 * Only use this function when the index is already locked.
599 * Find pages in the fulltext index containing the words,
624 $index = $this->getIndex('i', $wlen);
626 if ($ixid < count($index))
627 $docs["$wlen*$ixid"] = $this->parseTuples($page_idx, $index[$ixid]);
635 // handle the case when ($ixid < count($index)) has been false
657 * searched for as the first argument, and the word in the index as the
754 * Find the index ID of each search term.
758 * The $result parameter can be used to merge the index locations with
879 * @param string $key metadata key to list. Uses the fulltext index if not given
894 $index = $this->getIndex('title', '');
895 $index = array_count_values($index);
896 foreach ($index as $val => $cnt) {
902 $index = $this->getIndex($metaname . '_i', '');
904 foreach ($index as $wid => $line) {
920 $index = $this->getIndex('i', $length);
922 foreach ($index as $wid => $line) {
986 * Retrieve the entire index.
988 * The $suffix argument is for an index that is split into
989 * multiple parts. Different index files should use different
992 * @param string $idx name of the index
1007 * Replace the contents of the index with an array.
1009 * @param string $idx name of the index
1033 * Retrieve a line from the index.
1035 * @param string $idx name of the index
1058 * Write a line into the index.
1060 * @param string $idx name of the index
1102 * Retrieve or insert a value in the index.
1104 * @param string $idx name of the index
1106 * @param string $value line to find in the index
1107 * @return int|bool line number of the value in the index or false if writing the index failed
1113 $index = $this->getIndex($idx, $suffix);
1114 $id = array_search($value, $index, true);
1116 $id = count($index);
1117 $index[$id] = $value;
1118 if (!$this->saveIndex($idx, $suffix, $index)) {
1119 trigger_error("Failed to write $idx index", E_USER_ERROR);
1129 * Read the index directory or a cache file and returns
1144 * Reads the index directory and returns an array of lengths
1157 // testing if index files exist only