Commit b1fd0860 authored by Robert Griesemer's avatar Robert Griesemer

godoc: use correct time stamp to indicate accuracy of search result

- compare against fsModified to check if index is out of date
- don't change fsModified if there are no user-mapped file systems

R=rsc, iant
CC=golang-dev
https://golang.org/cl/3213041
parent b84b20b8
...@@ -186,11 +186,13 @@ func readDirList(filename string) ([]string, os.Error) { ...@@ -186,11 +186,13 @@ func readDirList(filename string) ([]string, os.Error) {
// is provided, it is used to filter directories. // is provided, it is used to filter directories.
// //
func updateMappedDirs(filter func(string) bool) { func updateMappedDirs(filter func(string) bool) {
fsMap.Iterate(func(path string, value *RWValue) bool { if !fsMap.IsEmpty() {
value.set(newDirectory(path, filter, -1)) fsMap.Iterate(func(path string, value *RWValue) bool {
return true value.set(newDirectory(path, filter, -1))
}) return true
invalidateIndex() })
invalidateIndex()
}
} }
...@@ -1323,7 +1325,7 @@ func lookup(query string) (result SearchResult) { ...@@ -1323,7 +1325,7 @@ func lookup(query string) (result SearchResult) {
result.Query = query result.Query = query
if index, timestamp := searchIndex.get(); index != nil { if index, timestamp := searchIndex.get(); index != nil {
result.Hit, result.Alt, result.Illegal = index.(*Index).Lookup(query) result.Hit, result.Alt, result.Illegal = index.(*Index).Lookup(query)
_, ts := fsTree.get() _, ts := fsModified.get()
result.Accurate = timestamp >= ts result.Accurate = timestamp >= ts
} }
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment