Closed Bug 1185687 Opened 9 years ago Closed 9 years ago

Stop showing symlinks in search results, and redirect to their source

Categories

(Webtools Graveyard :: DXR, defect)

defect
Not set
normal

Tracking

(firefox42 affected)

RESOLVED FIXED
Tracking Status
firefox42 --- affected

People

(Reporter: new_one, Assigned: new_one)

Details

Since we fixed bug 842547 and have begun to index the object directory, many previously direct searches now pull up two results: one in the source directory and one in the object directory which just symlinks to the source (especially python and idl files). Example: https://dxr.allizom.org/mozilla-central/search?q=path%3AnsIAccessible.idl.

I propose that we instead do not show symlinked files in search results, and when a user opens a symlink from either a direct link or browsing folders, they're taken to the source instead (presumably by redirect, but for folder browsing it could be direct link).
My spur-of-the-moment design from IRC:

I wonder if it would be enough to just add a "link" field to the FILE mapping.
It could contain a relpath pointing to the real file or folder.
Direct search and such would assert that the link field doesn't exist.
But having an entry for links in the FILE doctype would let us keep drawing them in directory listings.
We'd also have everything we need, while drawing the listings, to point the links straight to their targets, so no redirect would be needed on click.
(We could still support redirects if somebody surfs straight to the symlink's path.)
We would index no text out of files that are links. As a curiosity, we already call islink() from build.py.
I think that'll do it.
Assignee: nobody → peter.elmers
Here's my implementation of the design Erik listed: https://github.com/mozilla/dxr/pull/458.
Commit pushed to master at https://github.com/mozilla/dxr

https://github.com/mozilla/dxr/commit/fce834cea658a2cf44f3d4f38ad402085b417388
Fix bug 1185687, stop showing symlinks in search results.

New behaviors:
We do not call the by lines processing for symlinks at index time.
Symlinks do not appear in search results (lines and files).
A symlink in folder browsing will have its href set to the real target.
A direct link to symlink will redirect to its real target.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.