Source Forager: A Search Engine for Similar Source Code

06/08/2017
by   Vineeth Kashyap, et al.
0

Developers spend a significant amount of time searching for code: e.g., to understand how to complete, correct, or adapt their own code for a new context. Unfortunately, the state of the art in code search has not evolved much beyond text search over tokenized source. Code has much richer structure and semantics than normal text, and this property can be exploited to specialize the code-search process for better querying, searching, and ranking of code-search results. We present a new code-search engine named Source Forager. Given a query in the form of a C/C++ function, Source Forager searches a pre-populated code database for similar C/C++ functions. Source Forager preprocesses the database to extract a variety of simple code features that capture different aspects of code. A search returns the k functions in the database that are most similar to the query, based on the various extracted code features. We tested the usefulness of Source Forager using a variety of code-search queries from two domains. Our experiments show that the ranked results returned by Source Forager are accurate, and that query-relevant functions can be reliably retrieved even when searching through a large code database that contains very few query-relevant functions. We believe that Source Forager is a first step towards much-needed tools that provide a better code-search experience.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
06/06/2021

Clone-Seeker: Effective Code Clone Search Using Annotations

Source code search plays an important role in software development, e.g....
research
04/06/2022

DiffSearch: A Scalable and Precise Search Engine for Code Changes

The source code of successful projects is evolving all the time, resulti...
research
01/10/2020

Searching a Database of Source Codes Using Contextualized Code Search

We assume a database containing a large set of program source codes and ...
research
05/19/2023

Searching by Code: a New SearchBySnippet Dataset and SnippeR Retrieval Model for Searching by Code Snippets

Code search is an important task that has seen many developments in rece...
research
09/05/2022

Compressing integer lists with Contextual Arithmetic Trits

Inverted indexes allow to query large databases without needing to searc...
research
08/15/2019

Semantic Source Code Search: A Study of the Past and a Glimpse at the Future

With the recent explosion in the size and complexity of source codebases...
research
01/24/2022

Generating Clarifying Questions for Query Refinement in Source Code Search

In source code search, a common information-seeking strategy involves pr...

Please sign up or login with your details

Forgot password? Click here to reset