func listAll(index *structs.Index) { fmt.Println("Contents of the index:") for doc := range index.IteratorDocs() { fmt.Printf("%v\n", doc) for keyword := range index.IteratorKeywordsByDoc(doc) { fmt.Printf("\t%v\n", keyword) } } }
func listKeywords(index *structs.Index, doc string) { fmt.Printf("Keywords contained in %q:\n", doc) count := 0 for keyword := range index.IteratorKeywordsByDoc(doc) { count++ fmt.Printf("\t%v\n", keyword) } fmt.Printf("%v in total\n", count) }