I have fetched all my emails using JavaMail API but I want to implement the search feature as it is there in Gmail. Is it possible for us to use the gmail search feature through some interface programmatically, like using Gmail API?
If you're connecting via IMAP, either IMAP SEARCH (https://www.rfc-editor.org/rfc/rfc3501#page-49) or Google's IMAP extension X-GM-RAW (https://developers.google.com/gmail/imap_extensions#extension_of_the_search_command_x-gm-raw) seem like they would provide searching.