Lines Matching full:page
27 * Manages the page search index by delegating to Collection classes.
96 * @return string[] list of page names (keys are the RIDs in the page index)
100 $pageIndex = new MemoryIndex('page');
108 * Check if a page needs (re-)indexing
110 * @param string $page
114 public function needsIndexing(string $page, bool $force = false): bool argument
116 $idxtag = metaFN($page, '.indexed');
122 return $last <= @filemtime(wikiFN($page));
126 * Add/update the search index for a page
130 * @param string $page The page to index
137 public function addPage(string $page, bool $force = false): void argument
139 if (!$this->needsIndexing($page, $force)) {
140 $this->log("Indexer: index for $page up to date");
144 // create shared writable page index early so we can resolve the PID for plugins
145 $pageIndex = new FileIndex('page', '', true);
149 'page' => $page,
152 'title' => p_get_metadata($page, 'title', METADATA_RENDER_UNLIMITED),
154 p_get_metadata($page, 'relation references', METADATA_RENDER_UNLIMITED) ?? []
157 p_get_metadata($page, 'relation media', METADATA_RENDER_UNLIMITED) ?? []
159 … 'internal_index' => p_get_metadata($page, 'internal index', METADATA_RENDER_UNLIMITED) !== false,
161 'pid' => $pageIndex->accessCachedValue($page),
167 $data['body'] = $data['body'] . ' ' . rawWiki($data['page']);
174 ->addEntity($data['page'], [$data['metadata']['title']])->unlock();
180 … (new PageFulltextCollection($pageIndex))->lock()->addEntity($data['page'], $words)->unlock();
182 $this->log("Indexer: full text indexing disabled for {$data['page']}");
184 … (new PageFulltextCollection($pageIndex))->lock()->addEntity($data['page'], [])->unlock();
193 … (new PageMetaCollection($key, $pageIndex))->lock()->addEntity($data['page'], $values)->unlock();
200 io_saveFile(metaFN($data['page'], '.indexed'), $this->getVersion());
201 $this->log("Indexer: finished indexing {$data['page']}");
205 * Remove a page from the index
207 * Clears the page's data from all collections. The entity persists in page.idx.
209 * @param string $page The page to remove
216 public function deletePage(string $page, bool $force = false): void argument
218 $idxtag = metaFN($page, '.indexed');
220 $this->log("Indexer: $page.indexed file does not exist, ignoring");
224 $pageIndex = new FileIndex('page', '', true);
226 (new PageTitleCollection($pageIndex))->lock()->addEntity($page, [])->unlock();
227 (new PageFulltextCollection($pageIndex))->lock()->addEntity($page, [])->unlock();
230 (new PageMetaCollection($key, $pageIndex))->lock()->addEntity($page, [])->unlock();
233 $this->log("Indexer: deleted $page from index");
238 * Rename a page in the search index
240 * The page must already have been moved on disk before calling this.
241 * Clears the old page's data and re-indexes under the new name.
243 * @param string $oldpage The old page name
244 * @param string $newpage The new page name
257 * Clear all page indexes
263 Lock::acquire('page');
282 // clear title and page indexes
284 @unlink($conf['indexdir'] . '/page.idx');
287 Lock::release('page');
387 * Add metadata values for a page
389 * @param string $page page name
396 public function addMetaKeys($page, $key, $value = null) argument
406 $collection->lock()->addEntity($page, $values)->unlock();
484 * Get the page ID for a page name
486 * @param string $page page name
491 public function getPID($page) argument
495 return (new FileIndex('page', '', true))->accessCachedValue($page);
505 * @return array list of pages found [word => [page => count, ...]]
528 …$filtered = array_filter($freqs, fn($page) => page_exists($page, '', false), ARRAY_FILTER_USE_KEY);