Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
b037bfa6
Commit
b037bfa6
authored
Mar 20, 2010
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
godoc: proper file path conversion for remote search
R=rsc CC=golang-dev
https://golang.org/cl/664041
parent
f9d6af9f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
search.txt
lib/godoc/search.txt
+4
-3
godoc.go
src/cmd/godoc/godoc.go
+24
-0
No files found.
lib/godoc/search.txt
View file @
b037bfa6
QUERY = {Query}
QUERY
{Query}
{.section Accurate}
{.or}
...
...
@@ -21,7 +22,7 @@ package {Pak.Name}
{.repeated section Files}
{.repeated section Groups}
{.repeated section Infos}
{File.Path
|url-src
}:{@|infoLine}
{File.Path}:{@|infoLine}
{.end}
{.end}
{.end}
...
...
@@ -36,7 +37,7 @@ package {Pak.Name}
{.repeated section Files}
{.repeated section Groups}
{.repeated section Infos}
{File.Path
|url-src
}:{@|infoLine}
{File.Path}:{@|infoLine}
{.end}
{.end}
{.end}
...
...
src/cmd/godoc/godoc.go
View file @
b037bfa6
...
...
@@ -1394,5 +1394,29 @@ type IndexServer struct{}
func
(
s
*
IndexServer
)
Lookup
(
query
*
Query
,
result
*
SearchResult
)
os
.
Error
{
*
result
=
lookup
(
query
.
Query
)
if
hit
:=
result
.
Hit
;
hit
!=
nil
{
// the hitlists contain absolute server file paths;
// convert them into relative paths on the server
// because the client usually has a different file
// mapping
mapHitList
(
hit
.
Decls
)
mapHitList
(
hit
.
Others
)
}
return
nil
}
func
mapHitList
(
list
HitList
)
{
for
_
,
prun
:=
range
list
{
for
_
,
frun
:=
range
prun
.
Files
{
// convert absolute file paths to relative paths
f
:=
frun
.
File
if
f
!=
nil
&&
len
(
f
.
Path
)
>
0
&&
f
.
Path
[
0
]
==
'/'
{
f
.
Path
=
relativePath
(
f
.
Path
)
}
// TODO(gri) convert SpotInfos containing snippets
// so that the line number is available
// on the client side
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment