Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / Source
Exact symbol boost
A name spelled as an identifier, or passed as a hint, adds one more 1/61.
PINNED SOURCE Copied from the repository at this commit. Source, not an execution.
PHAROS at 975a38dMIT license
Retriever._symbol_boostbackend/app/codeintel/retrieval.py, lines 446–463Open source
def _symbol_boost(self, hits: dict[str, Hit], terms: list[str], query: str, hints: list[str] | None = None) -> None: compounds = symbol_like_terms(query) # A hint is a guessed name even when written in plain words ("parse url"). compounds |= {compound_name(part) for h in hints or [] for part in h.split(".") if compound_name(part)} if not compounds: return rows = self.db.execute( select(DocumentChunk.id, DocumentChunk.chunk_metadata).where( DocumentChunk.id.in_([uuid.UUID(c) for c in hits]) ) ).all() for cid, meta in rows: name = (meta or {}).get("name") or "" if name and compound_name(name) in compounds: h = hits[str(cid)] h.score += 1.0 / (RRF_K + 1) h.evidence.boosts.append("exact_symbol_name")Where this comes from
- Commit
975a38d5d17839c26ee219295a5be6ac66b6d910- File
backend/app/codeintel/retrieval.py- Lines
- 446–463
- Git blob
884729a39ae0b3d340ad83f75946677dcddf3791- License
- MIT, © 2024–2026 Pharos Contributors. Notice
Read it on GitHub at this commit
Check it yourself
From a clone of the repository, the first command prints the blob above and the second prints these lines.
git rev-parse 975a38d:backend/app/codeintel/retrieval.py
git show 975a38d:backend/app/codeintel/retrieval.py | sed -n '446,463p'