{"id":"bc0f1885663c25cc","repo":"gohugoio/hugo","slug":"indexing-currently-not-supported-for-index-q-and","errorCode":null,"errorMessage":"indexing currently not supported for index %q and type %T","messagePattern":"indexing currently not supported for index %q and type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"related/inverted_index.go","lineNumber":450,"sourceCode":"\t\tkeywords = append(keywords, cfg.stringToKeyword(vv))\n\tcase []string:\n\t\tvvv := make([]Keyword, len(vv))\n\t\tfor i := range vvv {\n\t\t\tvvv[i] = cfg.stringToKeyword(vv[i])\n\t\t}\n\t\tkeywords = append(keywords, vvv...)\n\tcase []any:\n\t\treturn cfg.ToKeywords(cast.ToStringSlice(vv))\n\tcase time.Time:\n\t\tlayout := \"2006\"\n\t\tif cfg.Pattern != \"\" {\n\t\t\tlayout = cfg.Pattern\n\t\t}\n\t\tkeywords = append(keywords, StringKeyword(vv.Format(layout)))\n\tcase nil:\n\t\treturn keywords, nil\n\tdefault:\n\t\treturn keywords, fmt.Errorf(\"indexing currently not supported for index %q and type %T\", cfg.Name, vv)\n\t}\n\n\treturn keywords, nil\n}\n\nfunc (idx *InvertedIndex) search(ctx context.Context, query ...queryElement) ([]Document, error) {\n\treturn idx.searchDate(ctx, nil, zeroDate, query...)\n}\n\nfunc (idx *InvertedIndex) searchDate(ctx context.Context, self Document, upperDate time.Time, query ...queryElement) ([]Document, error) {\n\tmatchm := make(map[Document]*rank, 200)\n\tdefer func() {\n\t\tfor _, r := range matchm {\n\t\t\tputRank(r)\n\t\t}\n\t}()\n\n\tapplyDateFilter := !idx.cfg.IncludeNewer && !upperDate.IsZero()","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/related/inverted_index.go#L432-L468","documentation":"`IndexConfig.ToKeywords` (related/inverted_index.go:427) converts a front matter value into search keywords for a related index. It supports string, []string, []any (of strings), time.Time and nil; any other Go type (maps, numbers, bools, structs) hits the default case and fails because Hugo doesn't know how to index it.","triggerScenarios":"A page's front matter param used as a related index holds an unsupported type — e.g. `related.indices` includes `name = 'author'` but pages set `author` to a map (`author: {name: ...}`), a number, or a bool; the error fires during indexing or when querying keywords for a document.","commonSituations":"Configuring a related index over a param that some pages define as a map/object; taxonomy-like params stored as numbers (`series: 2024`); mixing scalar and structured values for the same param across pages.","solutions":["Change the front matter param used by the index to a string or list of strings on every page (e.g. `series: [\"2024\"]` instead of `series: 2024`).","Point the related index at a different, string-valued param, or remove the index from `related.indices`.","If dates are intended, use a date-typed param — time.Time is supported (formatted with the index `pattern`, default `2006`)."],"exampleFix":"# before (front matter)\nauthor:\n  name: Jane\n# after\nauthors: [\"jane\"]  # and point related.indices at 'authors'","handlingStrategy":"type-guard","validationCode":"# Ensure the front matter value for an indexed key is a supported type\n# strings, string slices, or dates — not maps or nested objects\ntags: [\"go\", \"hugo\"]  # ok\n# tags: {name: go}    # NOT indexable","typeGuard":"func indexable(v any) bool {\n    switch v.(type) {\n    case string, []string, []any, time.Time:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := idx.Add(ctx, doc); err != nil {\n    return fmt.Errorf(\"page %s has un-indexable value for a related index (check front matter types): %w\", doc.Name(), err)\n}","preventionTips":["Keep front matter fields used by related indices as strings, string lists, or dates","When configuring a custom index over a params key, audit all pages for the value type of that key","Add a CI build so a page with a wrong-typed param fails fast rather than at deploy time"],"tags":["related-content","front-matter","type-error"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}