Class TermIndex

java.lang.Object
network.ike.docs.plugin.registry.TermIndex

public final class TermIndex extends Object
The term index IKE-INDEX.md and IKE-TOPIC-REGISTRY.md describe, term-index.yaml: the reverse mapping from the index terms a topic marks (indexterm:[primary, secondary], indexterm2:[term], ((term)), (((primary, secondary)))) to the topics that mark them. The registry's keywords say what a topic is about; its index terms say what it discusses.

Terms are collected once, when a topic is parsed, and kept on its registry entry as index-terms, each level joined with " > "; the index is then derived from the registry alone, so an incremental registry run never reopens a file to rebuild it (IKE-Network/ike-issues#1341).

Since:
136
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The separator between the levels of a term as the registry records it.
    static final String
    The key under which a level lists the topics indexed at it.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map<String,Object>
    model(Map<String,Object> registry, Instant now)
    The term index as an ordered map, ready for YAML, from a registry model whose topic entries carry index-terms: generated, term-count, then terms, a tree of levels in alphabetical order, each level with its _topics in id order and its sub-levels after.
    static List<String>
    termsOf(String content)
    The index terms one file marks, in order of appearance, each as its levels joined with LEVEL_SEPARATOR; a term marked twice is listed once.
    static String
    Render the term index as YAML, in the registry's block style.

    Methods inherited from class Object

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

    • TOPICS_KEY

      public static final String TOPICS_KEY
      The key under which a level lists the topics indexed at it.
      See Also:
    • LEVEL_SEPARATOR

      public static final String LEVEL_SEPARATOR
      The separator between the levels of a term as the registry records it.
      See Also:
  • Method Details

    • termsOf

      public static List<String> termsOf(String content)
      The index terms one file marks, in order of appearance, each as its levels joined with LEVEL_SEPARATOR; a term marked twice is listed once. A visible term, ((term)), is one level; a concealed one, (((primary, secondary))), splits on commas as indexterm:[] does. Lines that are comments are passed over.
      Parameters:
      content - the file content
      Returns:
      the terms, empty when the file marks none
    • model

      public static Map<String,Object> model(Map<String,Object> registry, Instant now)
      The term index as an ordered map, ready for YAML, from a registry model whose topic entries carry index-terms: generated, term-count, then terms, a tree of levels in alphabetical order, each level with its _topics in id order and its sub-levels after.
      Parameters:
      registry - the registry model, from TopicRegistry.model or TopicRegistry.load
      now - the generation instant, recorded as a date
      Returns:
      the term index model
    • yaml

      public static String yaml(Map<String,Object> model)
      Render the term index as YAML, in the registry's block style.
      Parameters:
      model - the model from model(Map, Instant)
      Returns:
      the YAML text