Lines Matching defs:page

135         foreach ($pages as $pid => $page) {
136 $chunkID = $pid * 100; // chunk IDs start at page ID * 100
139 !page_exists($page) ||
140 isHiddenPage($page) ||
141 filesize(wikiFN($page)) < 150 || // skip very small pages
142 ($skipRE && preg_match($skipRE, (string)$page)) ||
143 ($matchRE && !preg_match($matchRE, ":$page"))
145 // this page should not be in the index (anymore)
146 $this->storage->deletePageChunks($page, $chunkID);
151 if ($firstChunk && @filemtime(wikiFN($page)) < $firstChunk->getCreated()) {
152 // page is older than the chunks we have, reuse the existing chunks
153 $this->storage->reusePageChunks($page, $chunkID);
154 if ($this->logger instanceof CLI) $this->logger->info("Reusing chunks for $page");
156 // page is newer than the chunks we have, create new chunks
157 $this->storage->deletePageChunks($page, $chunkID);
158 $chunks = $this->createPageChunks($page, $chunkID);
166 * Split the given page, fetch embedding vectors and return Chunks
171 * @param string $page Name of the page to split
172 * @param int $firstChunkID The ID of the first chunk of this page
173 * @return Chunk[] A list of chunks created for this page
174 * @emits INDEXER_PAGE_ADD support plugins that add additional data to the page
177 public function createPageChunks($page, $firstChunkID)
182 $ID = $page;
184 $text = p_cached_output(wikiFN($page), 'aichat', $page);
187 'Failed to render page {page}. Using raw text instead. {msg}',
188 ['page' => $page, 'msg' => $e->getMessage()]
190 $text = rawWiki($page);
193 $crumbs = $this->breadcrumbTrail($page);
197 'page' => $page,
199 'metadata' => ['title' => $page, 'relation_references' => []],
219 'Failed to get embedding for chunk of page {page}: {msg}',
220 ['page' => $page, 'msg' => $e->getMessage()]
225 $chunkList[] = new Chunk($page, $firstChunkID, $part, $embedding);
232 ['id' => $page, 'count' => count($chunkList)]
235 $this->logger->warning('{id} could not be split into chunks', ['id' => $page]);
289 * Create a breadcrumb trail for the given page
291 * Uses the first heading of each namespace and the page itself. This is added as a prefix to
307 $page = $resolver->resolveId($check);
308 $title = p_get_first_heading($page);
312 // the page itself
314 $page = noNS($id);
315 $crumbs[] = $title ? "$title ($page)" : $page;