Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / module
indexer
codeintel.indexer
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| _decode | indexer.py | same file |
| _looks_minified | indexer.py | same file |
| _mean_vector | indexer.py | same file |
| _PreparedChunk | indexer.py | same file |
| _utcnow | indexer.py | same file |
| CodeIndexer | indexer.py | same file |
| IndexStats | indexer.py | same file |
| LanguageStats | indexer.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| embeddings | embeddings.py | through an import |
| git_source | git_source.py | through an import |
| graph | graph.py | through an import |
| languages | languages.py | through an import |
| parsers | __init__.py | through an import |
| text | text.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| jobs | jobs.py | through an import |
codeintel.indexerbackend/app/codeintel/indexer.py, lines 1–40Open source
"""Incremental, idempotent repository indexing.One call to :meth:`CodeIndexer.index` brings the database in line with arepository at one commit:1. Resolve the commit (shallow bare clone, or a local repository).2. If the repository is already indexed at that commit with the same embedding model, stop: re-ingestion is a no-op.3. Diff tracked files against the index by git blob SHA: * **new / changed** files are parsed, embedded and (re)written; * **deleted** files are removed with their chunks and edges; * **unchanged** files only have their commit pointers moved.4. Rebuild the repository's call / import / contains graph.5. Record the commit and statistics on the repository row.The repository's ``last_commit_sha`` is written only after every stepsucceeds. A crash mid-run leaves a mix of old and new files; the retrydiffs again and converges, because files already rewritten now match theirblob SHA. Raw source is never stored (hybrid storage): chunks keep apointer (commit, path, line span) and are resolved on demand."""from __future__ import annotationsimport loggingimport mathimport timefrom collections import defaultdictfrom collections.abc import Callablefrom dataclasses import asdict, dataclass, field, replacefrom datetime import UTC, datetimefrom sqlalchemy import delete, func, select, updatefrom sqlalchemy.orm import Sessionfrom ..database.models import ChunkDescription, CodeEdge, DocumentChunk, Repository, Resourcefrom ..utils.path_exclusions import has_excluded_ancestor, is_excluded_filefrom .embeddings import Embedder, EmbeddingUnavailablefrom .git_source import Checkout, RepoRef, TreeEntry, open_checkoutfrom .graph import ChunkNode, build_edgesShows the first 40 of 563 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
module backend.app.codeintel.indexer- File
backend/app/codeintel/indexer.py- Lines
- 1–563
- Parser
- python-ast
- Git blob
e8fdfa7b5545e821f7649d68cfadd2aae85b89d0- Call sites
- 1 named, 0 resolved, 1 left unlinked
- Outside this subset
- 8 more edges reach code outside the graph shown here
