Edgewall Software
Modify

Opened 19 years ago

Closed 19 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 Christian Boos, 19 years ago

Owner: changed from Jonas Borgström to Christian Boos
Severity: normalminor
Status: newassigned

comment:2 by Christian Boos, 19 years ago

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')

comment:3 by Christian Boos, 19 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 Christian Boos, 19 years ago

Milestone: 0.9
Resolution: fixed
Status: assignedclosed

Issue fixed in [2102] and suggestion above implemented in [2103].

comment:5 by Christian Boos, 19 years ago

Resolution: fixed
Status: closedreopened

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)

comment:6 by Christian Boos, 19 years ago

Resolution: fixed
Status: reopenedclosed

Also fixed by r2268

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.