Modify ↓
      
Opened 20 years ago
Closed 20 years ago
#1937 closed defect (fixed)
TracLink search: not working
| Reported by: | anonymous | Owned by: | Christian Boos | 
|---|---|---|---|
| Priority: | normal | Milestone: | 0.9 | 
| Component: | wiki system | Version: | 0.8.4 | 
| Severity: | minor | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
A TracLink like this one: Search module is not being linked.
This was originally added in #111 and is referenced in TracSearch.
Attachments (0)
Change History (6)
comment:1 by , 20 years ago
| Owner: | changed from to | 
|---|---|
| Severity: | normal → minor | 
| Status: | new → assigned | 
comment:2 by , 20 years ago
comment:3 by , 20 years ago
Also, the search: link format could be made similar 
to the query: link format: if the argument starts with ?,
then it's interpreted as an URL suffix.
This makes it possible to specify which filters to take into account:
search:?q=crash&ticket=on means search for crash only in the tickets
comment:4 by , 20 years ago
| Milestone: | → 0.9 | 
|---|---|
| Resolution: | → fixed | 
| Status: | assigned → closed | 
comment:5 by , 20 years ago
| Resolution: | fixed | 
|---|---|
| Status: | closed → reopened | 
This still doesn't work satisfyingly:
- Search module is not recognized as a link (depends on #2029)
 - & characters in search: links are escaped twice (depends on #2042)
 
  Note:
 See   TracTickets
 for help on using tickets.
    


  
There are two ways to solve this one:
1) restore the original call convention
/search/q=<search string>Index: trac/Search.py =================================================================== --- trac/Search.py (revision 2088) +++ trac/Search.py (working copy) @@ -246,5 +250,5 @@ def _format_link(self, formatter, ns, query, label): return '<a class="search" href="%s">%s</a>' \ - % (formatter.href.search(query), label) + % (formatter.href.search(q=query), label)But then, this breaks one test case, which made me believe that the search request convention has changed.
2) new request convention
/search/<search string>Index: trac/Search.py =================================================================== --- trac/Search.py (revision 2088) +++ trac/Search.py (working copy) @@ -123,7 +123,11 @@ # IRequestHandler methods def match_request(self, req): - return re.match(r'/search/?', req.path_info) is not None + match = re.match(r'/search(?:/(.*))?', req.path_info) + if match is not None: + if match.group(1): + req.args['q'] = match.group(1) + return True def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW')