Skip to content

Saved Searches Suggestion

dzan edited this page Sep 6, 2012 · 3 revisions

I spend some time recently on having "saved searches" or "filters" in K-9. My work on this is in https://github.com/dzan/k-9/tree/saved_searches_store . Basically this consists of two parts:

  • Improving our current searching logic. I made it more generic and more powerful. It's now possible for a SearchSpecification to almost specify each field that makes sense in the message table. I also cleaned up the way the actual query is done and the interface to pass it along. There is some work left on this and it still has to be tested a lot.

  • Providing a second interface to the preferences database which basically allows to store SearchSpecifications and load them. This has two purposes, first of all it will allow for user defined filters and second I now implemented the Unified Inbox and All Messages as a saved search ( in a wrapper to be able to put it in the Accounts mAdapter ). User filters could be placed on the Accounts screen very easily.

This all has some great benefits ( I think ):

  • Generic MessageList, it will just be displaying the results of a SearchSpecification at all times. It's not that much different from the current situation. The code changes a bit and there would be no more distinction between a MessageList displaying a search or just the content of a folder or the messages in a thread except from some ui elements. It's basically more of a way to think about things; when you see a MessageList it's a set of messages matching a search you either did yourself or one that was chosen for you.
    • The FolderList would just provide access to 'searches' which match the folders.
    • There would be 1 messagelist activity and searching in it is as easy as modifying the backing LocalSearch object and calling for a refresh.
    • ...
  • More powerful search. We could easily allow users to do more advanced searches, not only the subject and content would be searched.
  • Generic Accounts activity. It could now also be used to display different "sets" of messages even possibly defined by the user ( saved searches ).
  • Saved Searches. As explained above, this is a cool feature I think.
Clone this wiki locally