Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / class
CodeIndexer
codeintel.indexer.CodeIndexer
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 |
|---|---|---|
| run | jobs.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| __init__ | indexer.py | same file |
| _build_rows | indexer.py | same file |
| _count_chunks | indexer.py | same file |
| _count_lines | indexer.py | same file |
| _delete_resources | indexer.py | same file |
| _embed | indexer.py | same file |
| _index_batch | indexer.py | same file |
| _rebuild_graph | indexer.py | same file |
| _repoint_unchanged | indexer.py | same file |
| _skip_reason | indexer.py | same file |
| _sync | indexer.py | same file |
| get_or_create_repository | indexer.py | same file |
| index | indexer.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| indexer | indexer.py | same file |
codeintel.indexer.CodeIndexerbackend/app/codeintel/indexer.py, lines 141–200Open source
class CodeIndexer: def __init__( self, session: Session, embedder: Embedder | None, *, max_file_bytes: int = 1_000_000, max_files: int = 20_000, clone_timeout: int = 600, clone_token: str | None = None, heartbeat: Callable[[], None] | None = None, ) -> None: self.db = session self.embedder = embedder self.max_file_bytes = max_file_bytes self.max_files = max_files self.clone_timeout = clone_timeout self.clone_token = clone_token self.heartbeat = heartbeat or (lambda: None) # ── public ───────────────────────────────────────────────────────── def get_or_create_repository(self, ref: RepoRef, branch: str | None) -> Repository: repo = self.db.execute( select(Repository).where(Repository.url == ref.canonical_url) ).scalar_one_or_none() if repo is None: repo = Repository( url=ref.canonical_url, name=ref.name, repo_metadata={}, source_type=ref.source_type, branch=branch, local_path=ref.local_path, index_status="never_indexed", ) self.db.add(repo) self.db.flush() else: repo.branch = branch if ref.local_path: repo.local_path = ref.local_path return repo def index(self, ref: RepoRef, branch: str | None = None, *, force: bool = False) -> IndexStats: stats = IndexStats(repository=ref.canonical_url) stats.embedding_model = self.embedder.model_id if self.embedder else None t0 = time.monotonic() repo = self.get_or_create_repository(ref, branch) repo_id = repo.id previous_commit = repo.last_commit_sha previous_model = (repo.stats or {}).get("embedding_model") repo.index_status = "indexing" self.db.commit() try: t = time.monotonic() checkout = open_checkout(ref, branch=branch, token=self.clone_token, timeout=self.clone_timeout) stats.timings_s["checkout"] += time.monotonic() - tShows the first 60 of 423 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
class CodeIndexer:- File
backend/app/codeintel/indexer.py- Lines
- 141–563
- Parser
- python-ast
- Git blob
e8fdfa7b5545e821f7649d68cfadd2aae85b89d0- Outside this subset
- 16 more edges reach code outside the graph shown here
