id summary reporter owner description type status priority milestone component version severity resolution keywords cc branch changelog apichanges internalchanges 9643 [Patch] Ticket search by query with auto completion shesek "I was inspired by [http://youtrack.jetbrains.net/issues/ YouTrack ticket search box] and spent the last couple of hours hacking together something similar. Its based on [http://www.jqueryui.com/demos/autocomplete jQuery UI's autocomplete] and uses the regular TracQuery syntax, but with auto complete for field names, operators and (multi) values. Its not as good-looking as YouTrac, but still, its really neat :-) The way I implemented this is by making the regular search box a bit bigger, and my functionality is trigged when 'query:' is written. I thought it would be better than cluttering the interface with a separate search box. I'm afraid I don't know how to create those cool egg files, so I just wrote it as a one .py file (it doesn't do much anyhow, just adds JavaScript/CSS/jQuery-UI and give JSON responses of field values). You can [http://www.codenition.com/wp-content/TicketQuerySearch.zip download it here], just place `TicketQuerySearch.py` and the `TicketQuerySearch` directory in the plugins folder. That's about it. just write 'query:' in the top-right search box, and start writing a regular TracQuery. You can move around with the arrows and use tab, enter or the mouse to choose an item from the list. === Currently it supports: === - Auto completes the field name (either at the very beginning or after an '&'). - When a valid field name is typed/chosen, or when just one field name option is left in the suggestions, it start suggesting search operators. Those operators are also filtered as you type them. - Once an operator is written, it suggests values. - When a valid value is typed/chosen, it suggest you to add more values after a pipe (`|`). - Also, in some contexts it lets you choose 'Another field...' and 'Another value...' which simply adds `&` or `|` to the query. === A couple more notes: === - I know some people would prefer this to be a plugin and not part of core, but I think it gives much better UX when searching for tickets. It can completely replace the Custom Query page in most cases, making it much faster and easier to search. You can search using the keyboard alone, or by using some simple mouse clicks. The current Custom Query interface is great and much more advanced than this, but for simple searches its an overkill - it takes too much clicks and time to make searches. - I posted this ticket as soon as I got a working version, so it wasn't tested enough yet. I want to hear what you have to say about the idea in general, and what you think about the way I implemented this. I assume changes and fixes will be needed. - I'm not quite sure if you would want to ship jQuery UI with Trac. I downloaded a version that includes only what's necessary for [http://www.jqueryui.com/demos/autocomplete Autocomplete], and it weights around ~120KB (20KB for JavaScript and the rest is CSS&images). If needed, I can write a stand-alone Autocomplete functionality, but it probably won't be as good as jQuery-UI's. - Most of the auto-complete is done on the client-side. When searching in values of some fields (like component), the client downloads a full list of possible values (only when required), searches them and caches them for the next time a search is needed on the same field. As there aren't usually many values, I thought it would be better to download it once instead of hitting the server with a request every time the user types something. - Support for custom fields is missing. - Maybe the '!query:' prefix can be removed so it'll always be enabled? It does raise some questions (when the form is submitted, and the user typed 'status=new', did he mean to search for tickets with that status or just 'status=new' as plain string in the regular search?), but I think its all solvable." enhancement new high next-major-releases search system 0.13dev major patch javascript jqueryui autocomplete review search ismael@… leho@… ethan.jucovy@…