1
0
mirror of https://github.com/golang/go synced 2024-11-25 02:07:58 -07:00

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
This commit is contained in:
Robert Griesemer 2010-11-19 14:05:12 -08:00
parent b84b20b820
commit b1fd0860df

View File

@ -186,11 +186,13 @@ func readDirList(filename string) ([]string, os.Error) {
// is provided, it is used to filter directories.
//
func updateMappedDirs(filter func(string) bool) {
fsMap.Iterate(func(path string, value *RWValue) bool {
value.set(newDirectory(path, filter, -1))
return true
})
invalidateIndex()
if !fsMap.IsEmpty() {
fsMap.Iterate(func(path string, value *RWValue) bool {
value.set(newDirectory(path, filter, -1))
return true
})
invalidateIndex()
}
}
@ -1323,7 +1325,7 @@ func lookup(query string) (result SearchResult) {
result.Query = query
if index, timestamp := searchIndex.get(); index != nil {
result.Hit, result.Alt, result.Illegal = index.(*Index).Lookup(query)
_, ts := fsTree.get()
_, ts := fsModified.get()
result.Accurate = timestamp >= ts
}
return