Edgewall Software
Modify

Ticket #1937 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

TracLink search: not working

Reported by: anonymous Owned by: cboos
Priority: normal Milestone: 0.9
Component: wiki system Version: 0.8.4
Severity: minor Keywords:
Cc:
Release Notes:
API 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

Change History

comment:1 Changed 7 years ago by cboos

  • Owner changed from jonas to cboos
  • Severity changed from normal to minor
  • Status changed from new to assigned

comment:2 Changed 7 years ago by cboos

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 Changed 7 years ago by cboos

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 Changed 7 years ago by cboos

  • Milestone set to 0.9
  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:5 Changed 7 years ago by cboos

  • Resolution fixed deleted
  • Status changed from closed to 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)

comment:6 Changed 7 years ago by cboos

  • Resolution set to fixed
  • Status changed from reopened to closed

Also fixed by r2268

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.