diff options
author | Robert Griesemer <gri@golang.org> | 2011-01-18 10:59:54 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2011-01-18 10:59:54 -0800 |
commit | 1b112c2297e0ddb0432b1d2a718383ce4959d995 (patch) | |
tree | 1f114bb745b606e14a33822ca326ee8a1305fd9b | |
parent | 661bcb773ba2be6442756bf6d44590a8c4ba4d98 (diff) | |
download | go-1b112c2297e0ddb0432b1d2a718383ce4959d995.tar.gz go-1b112c2297e0ddb0432b1d2a718383ce4959d995.zip |
godoc: bring back "indexing in progress" message
A wrongly nested if prevented the message from appearing.
Fixes #1420.
R=r, r2
CC=golang-dev
https://golang.org/cl/3987043
-rw-r--r-- | src/cmd/godoc/godoc.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go index d6054ab9d3..0fb9f5324c 100644 --- a/src/cmd/godoc/godoc.go +++ b/src/cmd/godoc/godoc.go @@ -1172,7 +1172,8 @@ func lookup(query string) (result SearchResult) { lookupStr = prefix } - if index, timestamp := searchIndex.get(); index != nil { + index, timestamp := searchIndex.get() + if index != nil { // identifier search index := index.(*Index) result.Hit, result.Alt, err = index.Lookup(lookupStr) @@ -1188,12 +1189,16 @@ func lookup(query string) (result SearchResult) { const max = 10000 // show at most this many fulltext results result.Found, result.Textual = index.LookupRegexp(lookupRx, max+1) result.Complete = result.Found <= max + } - // is the result accurate? - if _, ts := fsModified.get(); timestamp < ts { - result.Alert = "Indexing in progress: result may be inaccurate" - } + // is the result accurate? + if _, ts := fsModified.get(); timestamp < ts { + // The index is older than the latest file system change + // under godoc's observation. Indexing may be in progress + // or start shortly (see indexer()). + result.Alert = "Indexing in progress: result may be inaccurate" } + return } |