Introduction
Semantic code search tools have become essential for modern software development, yet they often suffer from a "context gap." While these tools can effectively find code that matches a functional description—such as a generic formula for calculating emissions—they frequently fail to account for the specific domain or industry requirements of a project. CHICOT (Code search with HIgh level COnText) addresses this limitation by incorporating a project's high-level purpose, extracted from repository documentation, into the search process.
Methodology
The CHICOT architecture bridges the gap between raw codebases and developer environments through a multi-stage pipeline designed for context-aware retrieval.
Data Acquisition and Extraction
The system utilizes a crawler to gather high-quality GitHub repositories (filtered for >100 stars). From these, a Code Parser extracts individual functions, while a Contextual Information Extractor processes the repository's README. To minimize noise from installation guides or contributor lists, the extractor employs "LEAD-k" summarization, focusing on the first five lines to capture the project's core domain.
Dual-Tower Retrieval Engine
Relevance is determined by two distinct scoring mechanisms that evaluate different aspects of the query ($q$):
- Code Similarity ($s_{q,f}$): Matches the query to function logic using models trained on CodeSearchNet.
- Context Similarity ($s_{q,c}$): Matches the query to README-derived context using models trained on MS-Marco.
The final ranking is a weighted sum: $s_{q,f,c} = (1 - w) imes s_{q,f} + w imes s_{q,c}$. This weighting allows developers to tune the system to prioritize domain specificity ($w$) over generic functional matching.
Datasets and Evaluation
CHICOT indexes approximately 6 million functions from 20,000 GitHub repositories. Because standard benchmarks focus almost exclusively on code-level specifications, the authors developed a new evaluation set of 25 complex queries requiring both functional and contextual alignment (e.g., "Calculate prices of equipment in tax management systems").
Implementation and Results
CHICOT is implemented as a VSCode plugin, enabling a seamless four-step workflow: coding, submitting a query, receiving context-matched code, and immediate reuse. This integration allows developers to see the retrieved code side-by-side with the project description that justified its selection.
In qualitative testing, CHICOT successfully retrieved niche logic—such as aviation-specific carbon offsets—that generic tools overlooked. While the quantitative Precision@10 was 6.4%, the authors emphasize that providing even one highly relevant, domain-specific result on the first page significantly boosts developer productivity compared to sorting through dozens of generic, irrelevant snippets.
Conclusion and Future Work
CHICOT demonstrates the efficacy of using READMEs as proxies for high-level context. Future work will focus on increasing context granularity—moving from repository-level to file-level context—and improving joint-embedding models to further enhance search precision in complex, multi-alignment scenarios.
Summary updated