func topLevelIndexingRecord()

in Sources/SwiftDocC/Indexing/RenderNode+Indexable.swift [37:69]


    func topLevelIndexingRecord() throws -> IndexingRecord {
        let kind: IndexingRecord.Kind
        switch self.kind {
        case .tutorial:
            kind = .tutorial
        case .section:
            kind = .tutorialSection
        case .overview:
            kind = .overview
        case .article:
            kind = .article
        case .symbol:
            kind = .symbol
        }
        
        guard let title = metadata.title, !title.isEmpty else {
            // We at least need a title for a search result.
            throw IndexingError.missingTitle(identifier)
        }
        
        let summaryParagraph: RenderBlockContent?
        if let abstract = self.abstract {
            summaryParagraph = RenderBlockContent.paragraph(inlineContent: abstract)
        } else if let intro = self.sections.first as? IntroRenderSection, let firstBlock = intro.content.first, case .paragraph = firstBlock {
            summaryParagraph = firstBlock
        } else {
            summaryParagraph = nil
        }

        let summary = summaryParagraph?.rawIndexableTextContent(references: references) ?? ""
        
        return IndexingRecord(kind: kind, location: .topLevelPage(identifier), title: title, summary: summary, headings: self.headings, rawIndexableTextContent: self.rawIndexableTextContent)
    }