Edgewall Software

Opened 7 years ago

Last modified 6 years ago

#11428 new enhancement

Limit search realm when using quick search bar

Reported by: Ben Allen <ben.allen@…> Owned by:
Priority: normal Milestone: undecided
Component: search system Version: 1.0.1
Severity: normal Keywords:
Cc: ethan.jucovy@… Branch:
Release Notes:
API Changes:
Internal Changes:



I frequently find myself using the quick search bar at the top of the page to search for things in a particular realm (wiki, milestones, etc). My typical workflow looks like this:

  1. Type search terms in quick search bar, press enter
  2. Once the results page loads, untick the boxes for changesets, tickets, and milestones
  3. Click 'Search'
  4. Desired search page finally loads

Doing a realm-limited search actually requires two searches, which can take a long time on systems that have a lot of content or are behind a slow connection. It would be helpful if there was a way to limit a search to a specific realm from the quick search bar. This would reduce the above process to one step and reduce the number of page loads needed. It would also reduce the number of times the user has to switch between using the mouse and the keyboard, which is something that slows many users down (especially those of us stuck on laptops with trackpads).

Current Workarounds

You can do a realm-limited search like this by clicking the "Search" button on the top toolbar and using that search form instead of the quick search bar. This approach is sub-optimal because it still requires an unnecessary page load. It also doesn't handle some handy use cases like dragging and dropping text from a page into the quick search bar.

You can also do this by entering a complete Trac search string in the quick search bar (like search:?q=search+terms&wiki=on). The syntax required for this method is too arcane for most users to use on a regular basis.

Proposed Solution

The quick search bar can be enhanced to recognize a specially-formatted realm name as the first argument, and then limit the results of the search to that realm. For example, something like this could be used to perform a quick search that only covers the wiki:

[wiki] search terms
realm:wiki search terms
wiki: search terms

I'm not sure what the best syntax for this sort of thing would be, but you get the idea. You could even extend this to support multiple or inverted selections, like:

# Limit search to wiki and commit messages
realm:wiki,changesets search terms
# Search everything *except* the wiki
realm:-wiki search terms

Based on my limited understanding of the Trac code, it looks like this would require the process_request method of class SearchModule to update the local variable filters when one of these realm-limiting tags is present and then delete that portion of the search string from query.

Attachments (0)

Change History (2)

comment:1 by ethan.jucovy@…, 7 years ago

Cc: ethan.jucovy@… added

comment:2 by Ryan J Ollos, 6 years ago

Milestone: undecided

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

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