Source Code Search Ranking by Reference Popularity

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Developers face the challenge of manually sorting through a large number of results when searching for symbol definitions in large code bases, as existing text editor applications do not efficiently rank files based on relevance.

Innovation Solution

A method is introduced that derives a score for each file based on the quantity of references within the source code of other files, allowing for the ranking of matching files upon a query, with optional consideration of context to prioritize results.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If developers search for symbol definitions in large code bases using existing text editor applications, then the search function can locate symbol definitions, but the number of results returned becomes very large requiring manual sorting

Engineering Contradiction:
Improvesearch accuracyVSAvoidnumber of results
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The patent changes the parameter of result presentation from unranked to ranked by deriving a popularity score for each file. This score is calculated based on the quantity of references to each file in the source code, transforming the search results into a ranked list that prioritizes more relevant files.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent introduces an intermediary ranking mechanism that acts as a mediator between the search query and the results. This intermediary computes a popularity score based on reference quantities and uses it to rank files, thereby reducing the need for manual sorting by developers.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If the code base grows in size, then more symbols and definitions are available, but the number of results for a given query increases requiring increasingly more manual sorting time

Engineering Contradiction:
Improvecode base coverageVSAvoidmanual sorting time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent performs preliminary action by pre-computing popularity scores for all files in the code base based on their reference quantities. This pre-computed ranking information is stored and reused when search queries are executed, allowing the system to handle growing code bases efficiently without increasing manual sorting time for each query.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces a new parameter (popularity score derived from reference quantity) that enables the system to adapt to growing code bases. By ranking results based on this parameter, the system maintains search efficiency even as the code base expands and the number of potential results increases.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If all matching files are returned for a symbol definition query, then complete results are provided, but developers must manually sort through each result to select the appropriate definition

Engineering Contradiction:
Improveresult completenessVSAvoidresult selection ease
Core Design Contradiction:
ReliabilityVSEase of operation

Solution Approach 1:

The patent changes the presentation parameter from a flat list of matching files to a ranked list ordered by popularity score. This transformation maintains result completeness (all matching files are still returned) while significantly improving ease of operation by presenting the most relevant files first based on their reference quantities.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent segments the results into a ranked hierarchy based on popularity scores. Files are segmented into different levels of relevance, with highly referenced files appearing first and less referenced files appearing later, allowing developers to quickly find appropriate definitions without sorting through the entire list.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS8122017B1Enhanced retrieval of source code
Publication Date: 2012.02.21 GOOGLE LLC
  • US8122017B1 patent drawing
  • US8122017B1 patent drawing
  • US8122017B1 patent drawing

AI summary

Methods, systems, and apparatus, including computer program products are provided for indexing tags in source code. Implementations provide an enhanced retrieval of source code, in which a score for each of a plurality of files is derived based on a quantity of references to each file in source code of the remaining plurality of files. A query is received identifying a source code tag. Matching files of the plurality of files that satisfy the query are identified, a ranking of the matching files is generated based on the derived scores, and the ranking is provided.