How would you implement a functionality like thunderbird's "quick search"?
The well-known Mozilla Thunderbird email client has a search bar called "filter these messages". It allows the user to quickly filter messages by displaying only those whose title, sender or recipients contain the words that the user types.
How would you implement such a functionality, given that it has to be as fast as possible even when displaying tons of messages? Should one use a precomputed index or similar data structu开发者_如何学Gore? Or simply iterate through the messages?
The beauty of open source software is that you can see the source :). You can even view the source code online:
- View/Search Mozilla source code online: you can find the current Thunderbird source
- Other ways to get the source code
- I think it's called a quickFilterBar
Be very careful and play nice when you look at Mozilla's source code! It would be very rude if you violate their licensing.
I would initially start by doing a direct search and if the performance is insufficient, then I'll try to find a way to improve it. If you're really strapped for performance, then maybe try and implementing some of the data structures used by Google.
精彩评论