Class SearchIndex

java.lang.Object
ai.redouble.docs.SearchIndex

public class SearchIndex extends Object
What the site's search box searches: one entry per place a reader can land on, written as the page asset search-index.js. A page gives one entry for its opening, found by the page's title, and one per heading, found by the heading and reached at the heading's anchor; a build that ships the javadoc tree adds one entry per public class, reached at the class's javadoc page. The text of an entry is what the reader sees under that heading, code included, with the markdown syntax gone. The index is a script rather than a JSON file because a page opened from disk may load a script and may not fetch a file. The page loads it, and the search library, the first time the search box takes focus.
Since:
0.1 (2026-10-01)
Author:
Andrey Santrosyan
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    One place a search lands on: the address relative to the site's root, the title of the page or the name of the class, the part of the contents the page belongs to (null for the front matter), the heading of the section (null for a page's opening and for a class) and the text searched.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The part every class entry carries where a page's entry carries its part of the contents.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addClasses(Map<String,String> classIndex)
    One entry per class of the javadoc class index, found by the class's name and its package.
    void
    addPage(GenerateDocs.Page page, com.vladsch.flexmark.util.ast.Document document)
    The entries of one page, from the document the page was rendered from: rendering is what gives each heading its anchor, so the document must have been rendered already.
     
    void
    write(Path docsDir)
    Writes search-index.js, the entries as the array SEARCH_INDEX.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • JAVADOC

      public static final String JAVADOC
      The part every class entry carries where a page's entry carries its part of the contents.
      See Also:
  • Constructor Details

    • SearchIndex

      public SearchIndex()
  • Method Details

    • addPage

      public void addPage(GenerateDocs.Page page, com.vladsch.flexmark.util.ast.Document document)
      The entries of one page, from the document the page was rendered from: rendering is what gives each heading its anchor, so the document must have been rendered already.
    • addClasses

      public void addClasses(Map<String,String> classIndex)
      One entry per class of the javadoc class index, found by the class's name and its package.
    • entries

      public List<SearchIndex.Entry> entries()
    • write

      public void write(Path docsDir) throws IOException
      Writes search-index.js, the entries as the array SEARCH_INDEX.
      Throws:
      IOException