User:Emre/tb/architecture/diagrams/messagesearch

From MozillaWiki
Jump to: navigation, search

Message Search Components

Class Diagram

Message-search.cd.png

Offline Search

Search queries done in message header scope are conducted on local database, for both offline and online accounts. If the search scope is message body, the search type is determined by the mode (offline/online) of the selected folder.

Search operation is executed by the UI thread in constant time slices. When the user type a search query, a timer object is created to complete the operation in an asynchronous fashion. Each tick, or time slice, conducts a serial, contiguous search on the database. Matching records are added into the result table and the listeners are notified to consume the results.

Message-search-offline.sd.png

Online Search

In case of online search, search query is converted to the protocol's native format and sent to the server. Timer doesn't involve in this mechanism. Search results are populated using a callback mechanism provided by nsImapMailFolder (in IMAP case).

Message-search-online.sd.png