Class MessageIndexBuilder
java.lang.Object
org.bluezoo.gumdrop.mailbox.index.MessageIndexBuilder
Builds
MessageIndexEntry objects by parsing messages using
the MessageParser.
This builder extracts all searchable header fields from messages and stores them in lowercase for case-insensitive searching.
Usage:
MessageIndexBuilder builder = new MessageIndexBuilder();
MessageIndexEntry entry = builder.buildEntry(
uid, messageNumber, size, flags, location, messageChannel);
- Author:
- Chris Burdess
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildEntry(long uid, int messageNumber, long size, long internalDate, Set<Flag> flags, String location, ReadableByteChannel channel) Builds an index entry for a message.extractAddresses(String addresses) Extracts individual email addresses from a concatenated address string.extractKeywords(String keywords) Extracts individual keywords from a comma-separated keyword string.
-
Constructor Details
-
MessageIndexBuilder
public MessageIndexBuilder()
-
-
Method Details
-
buildEntry
public MessageIndexEntry buildEntry(long uid, int messageNumber, long size, long internalDate, Set<Flag> flags, String location, ReadableByteChannel channel) throws IOException Builds an index entry for a message.- Parameters:
uid- the message UIDmessageNumber- the message sequence numbersize- the message size in bytesinternalDate- the internal date (when received), or 0 if unknownflags- the message flagslocation- the message location (filename for Maildir, offset for mbox)channel- readable channel for message content- Returns:
- the built index entry
- Throws:
IOException- if reading or parsing fails
-
extractAddresses
Extracts individual email addresses from a concatenated address string. Used for building reverse indexes.- Parameters:
addresses- concatenated address string- Returns:
- list of individual addresses
-
extractKeywords
Extracts individual keywords from a comma-separated keyword string. Used for building reverse indexes.- Parameters:
keywords- comma-separated keywords- Returns:
- list of individual keywords
-