Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Googleapis Python genai Sphinx SearchTools

From Leeroopedia
Knowledge Sources
Domains Documentation, Search
Last Updated 2026-02-15 14:00 GMT

Overview

Concrete tool implementing the client-side full-text search engine for the Sphinx documentation site.

Description

The Search object provides the complete search UI and execution engine for Sphinx documentation. It includes query parsing with stemming (_parseQuery), object/API search (performObjectSearch), full-text term search with relevance scoring (performTermsSearch), result display, and the Scorer configuration object for tuning match weights. It processes a pre-built search index loaded at page load time.

Usage

This JavaScript file powers the search functionality on the generated API documentation site. It is loaded automatically and initializes from URL query parameters.

Code Reference

Source Location

Signature

var Scorer = {
    objNameMatch: 11,
    objPartialMatch: 6,
    title: 15,
    term: 5,
};

var Search = {
    init: function() { ... },
    loadIndex: function(url) { ... },
    query: function(query) { ... },
    performObjectSearch: function(object, objectTerms) { ... },
    performTermsSearch: function(searchTerms, excludedTerms) { ... },
    makeSearchSummary: function(htmlText, keywords) { ... },
};

Import

<script src="_static/searchtools.js"></script>

I/O Contract

Inputs

Name Type Required Description
query string Yes Search query from user input or URL parameter

Outputs

Name Type Description
Search results DOM elements Rendered search result list with links, scores, and summaries

Usage Examples

// Automatic initialization from URL parameters
// e.g., docs/search.html?q=generate+content

// The search engine:
// 1. Parses query into terms and exclusions
// 2. Stems each term using EnglishStemmer
// 3. Searches object index (API names, modules)
// 4. Searches full-text index (document content)
// 5. Scores and ranks results
// 6. Renders result list in the page

Related Pages

(No SDK environment or heuristic dependencies - documentation asset only)

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment