Id
- public class LuceneMessageSearchIndex<Id> extends ListeningMessageSearchIndex<Id>
ListeningMessageSearchIndex
which offers message searching via a Lucene indexMailboxListener.Added, MailboxListener.Event, MailboxListener.Expunged, MailboxListener.FlagsUpdated, MailboxListener.MailboxACLUpdated, MailboxListener.MailboxAdded, MailboxListener.MailboxDeletion, MailboxListener.MailboxRenamed, MailboxListener.MessageEvent
Modifier and Type | Field and Description |
---|---|
static String |
BASE_SUBJECT_FIELD |
static String |
BCC_FIELD
Field which will contain the BCC-Address of the message |
static String |
BODY_FIELD
Field which will contain the body of the Message |
static String |
CC_FIELD
Field which will contain the CC-Address of the message |
static int |
DEFAULT_MAX_QUERY_RESULTS
Default max query results
|
static String |
FIRST_CC_MAILBOX_NAME_FIELD |
static String |
FIRST_FROM_MAILBOX_DISPLAY_FIELD |
static String |
FIRST_FROM_MAILBOX_NAME_FIELD |
static String |
FIRST_TO_MAILBOX_DISPLAY_FIELD |
static String |
FIRST_TO_MAILBOX_NAME_FIELD |
static String |
FLAGS_FIELD
|
static String |
FROM_FIELD
Field which will contain the FROM-Address of the message |
static String |
HEADERS_FIELD
Field which will contain the whole message header of the Message |
static String |
ID_FIELD
Field which will contain the unique index of the Document |
static String |
INTERNAL_DATE_FIELD_DAY_RESOLUTION
Field which contain the internalDate of the message with DAY-Resolution |
static String |
INTERNAL_DATE_FIELD_HOUR_RESOLUTION
Field which contain the internalDate of the message with HOUR-Resolution |
static String |
INTERNAL_DATE_FIELD_MILLISECOND_RESOLUTION
Field which contain the internalDate of the message with MILLISECOND-Resolution |
static String |
INTERNAL_DATE_FIELD_MINUTE_RESOLUTION
Field which contain the internalDate of the message with MINUTE-Resolution |
static String |
INTERNAL_DATE_FIELD_MONTH_RESOLUTION
Field which contain the internalDate of the message with MONTH-Resolution |
static String |
INTERNAL_DATE_FIELD_SECOND_RESOLUTION
Field which contain the internalDate of the message with SECOND-Resolution |
static String |
INTERNAL_DATE_FIELD_YEAR_RESOLUTION
Field which contain the internalDate of the message with YEAR-Resolution |
static String |
MAILBOX_ID_FIELD
Field which will contain the id of the Mailbox |
static String |
MODSEQ_FIELD
Field which will contain the mod-sequence of the message |
static String |
NON_EXIST_FIELD |
static String |
PREFIX_HEADER_FIELD
Prefix which will be used for each message header to store it also in a seperate
Field |
static String |
SENT_DATE_FIELD_DAY_RESOLUTION
Field which contain the Date header of the message with DAY-Resolution |
static String |
SENT_DATE_FIELD_HOUR_RESOLUTION
Field which contain the Date header of the message with HOUR-Resolution |
static String |
SENT_DATE_FIELD_MILLISECOND_RESOLUTION
Field which contain the Date header of the message with MILLISECOND-Resolution |
static String |
SENT_DATE_FIELD_MINUTE_RESOLUTION
Field which contain the Date header of the message with MINUTE-Resolution |
static String |
SENT_DATE_FIELD_MONTH_RESOLUTION
Field which contain the Date header of the message with MONTH-Resolution |
static String |
SENT_DATE_FIELD_SECOND_RESOLUTION
Field which contain the Date header of the message with SECOND-Resolution |
static String |
SENT_DATE_FIELD_YEAR_RESOLUTION
Field which contain the Date header of the message with YEAR-Resolution |
static String |
SENT_DATE_SORT_FIELD_MILLISECOND_RESOLUTION |
static String |
SIZE_FIELD
Field which will contain the size of the Message |
static String |
TO_FIELD
Field which will contain the TO-Address of the message |
static String |
UID_FIELD
Field which will contain uid of the Message |
Constructor and Description |
---|
LuceneMessageSearchIndex(MessageMapperFactory<Id> factory,
org.apache.lucene.store.Directory directory) |
LuceneMessageSearchIndex(MessageMapperFactory<Id> factory,
org.apache.lucene.store.Directory directory,
boolean dropIndexOnStart,
boolean lenient) |
LuceneMessageSearchIndex(MessageMapperFactory<Id> factory,
org.apache.lucene.index.IndexWriter writer) |
Modifier and Type | Method and Description |
---|---|
void |
add(MailboxSession session,
Mailbox<Id> mailbox,
Message<Id> membership)
|
protected org.apache.lucene.analysis.Analyzer |
createAnalyzer(boolean lenient)
Create a
Analyzer which is used to index the Message 's |
protected org.apache.lucene.index.IndexWriterConfig |
createConfig(org.apache.lucene.analysis.Analyzer analyzer,
boolean dropIndexOnStart) |
void |
delete(MailboxSession session,
Mailbox<Id> mailbox,
MessageRange range)
Delete the
MessageRange for the given Mailbox from the index |
Iterator<Long> |
search(MailboxSession session,
Mailbox<Id> mailbox,
SearchQuery searchQuery)
Return all uids of the previous indexed
Mailbox 's which match the SearchQuery |
void |
setEnableSuffixMatch(boolean suffixMatch)
If set to true this implementation will use
WildcardQuery to match suffix and prefix. |
void |
setMaxQueryResults(int maxQueryResults)
Set the max count of results which will get returned from a query.
|
void |
update(MailboxSession session,
Mailbox<Id> mailbox,
MessageRange range,
javax.mail.Flags f)
|
event, getFactory, isClosed
public static final int DEFAULT_MAX_QUERY_RESULTS
public static final String ID_FIELD
Field
which will contain the unique index of the Document
public static final String UID_FIELD
Field
which will contain uid of the Message
public static final String FLAGS_FIELD
public static final String SIZE_FIELD
Field
which will contain the size of the Message
public static final String BODY_FIELD
Field
which will contain the body of the Message
public static final String PREFIX_HEADER_FIELD
Field
public static final String HEADERS_FIELD
Field
which will contain the whole message header of the Message
public static final String MODSEQ_FIELD
Field
which will contain the mod-sequence of the messagepublic static final String TO_FIELD
Field
which will contain the TO-Address of the messagepublic static final String FIRST_TO_MAILBOX_NAME_FIELD
public static final String FIRST_TO_MAILBOX_DISPLAY_FIELD
public static final String CC_FIELD
Field
which will contain the CC-Address of the messagepublic static final String FIRST_CC_MAILBOX_NAME_FIELD
public static final String FROM_FIELD
Field
which will contain the FROM-Address of the messagepublic static final String FIRST_FROM_MAILBOX_NAME_FIELD
public static final String FIRST_FROM_MAILBOX_DISPLAY_FIELD
public static final String BCC_FIELD
Field
which will contain the BCC-Address of the messagepublic static final String BASE_SUBJECT_FIELD
public static final String INTERNAL_DATE_FIELD_YEAR_RESOLUTION
Field
which contain the internalDate of the message with YEAR-Resolutionpublic static final String INTERNAL_DATE_FIELD_MONTH_RESOLUTION
Field
which contain the internalDate of the message with MONTH-Resolutionpublic static final String INTERNAL_DATE_FIELD_DAY_RESOLUTION
Field
which contain the internalDate of the message with DAY-Resolutionpublic static final String INTERNAL_DATE_FIELD_HOUR_RESOLUTION
Field
which contain the internalDate of the message with HOUR-Resolutionpublic static final String INTERNAL_DATE_FIELD_MINUTE_RESOLUTION
Field
which contain the internalDate of the message with MINUTE-Resolutionpublic static final String INTERNAL_DATE_FIELD_SECOND_RESOLUTION
Field
which contain the internalDate of the message with SECOND-Resolutionpublic static final String INTERNAL_DATE_FIELD_MILLISECOND_RESOLUTION
Field
which contain the internalDate of the message with MILLISECOND-Resolutionpublic static final String MAILBOX_ID_FIELD
Field
which will contain the id of the Mailbox
public static final String SENT_DATE_FIELD_YEAR_RESOLUTION
Field
which contain the Date header of the message with YEAR-Resolutionpublic static final String SENT_DATE_FIELD_MONTH_RESOLUTION
Field
which contain the Date header of the message with MONTH-Resolutionpublic static final String SENT_DATE_FIELD_DAY_RESOLUTION
Field
which contain the Date header of the message with DAY-Resolutionpublic static final String SENT_DATE_FIELD_HOUR_RESOLUTION
Field
which contain the Date header of the message with HOUR-Resolutionpublic static final String SENT_DATE_FIELD_MINUTE_RESOLUTION
Field
which contain the Date header of the message with MINUTE-Resolutionpublic static final String SENT_DATE_FIELD_SECOND_RESOLUTION
Field
which contain the Date header of the message with SECOND-Resolutionpublic static final String SENT_DATE_FIELD_MILLISECOND_RESOLUTION
Field
which contain the Date header of the message with MILLISECOND-Resolutionpublic static final String SENT_DATE_SORT_FIELD_MILLISECOND_RESOLUTION
public static final String NON_EXIST_FIELD
public LuceneMessageSearchIndex(MessageMapperFactory<Id> factory, org.apache.lucene.store.Directory directory) throws org.apache.lucene.index.CorruptIndexException, org.apache.lucene.store.LockObtainFailedException, IOException
org.apache.lucene.index.CorruptIndexException
org.apache.lucene.store.LockObtainFailedException
IOException
public LuceneMessageSearchIndex(MessageMapperFactory<Id> factory, org.apache.lucene.store.Directory directory, boolean dropIndexOnStart, boolean lenient) throws org.apache.lucene.index.CorruptIndexException, org.apache.lucene.store.LockObtainFailedException, IOException
org.apache.lucene.index.CorruptIndexException
org.apache.lucene.store.LockObtainFailedException
IOException
public LuceneMessageSearchIndex(MessageMapperFactory<Id> factory, org.apache.lucene.index.IndexWriter writer)
public void setMaxQueryResults(int maxQueryResults)
DEFAULT_MAX_QUERY_RESULTS
maxQueryResults
- protected org.apache.lucene.index.IndexWriterConfig createConfig(org.apache.lucene.analysis.Analyzer analyzer, boolean dropIndexOnStart)
protected org.apache.lucene.analysis.Analyzer createAnalyzer(boolean lenient)
Analyzer
which is used to index the Message
'slenient
- public void setEnableSuffixMatch(boolean suffixMatch)
WildcardQuery
to match suffix and prefix. This is what RFC3501 expects but is often not what the user does.
It also slow things a lot if you have complex queries which use many "TEXT" arguments. If you want the implementation to behave strict like RFC3501 says, you should
set this to true.
The default is false for performance reasonssuffixMatch
- public Iterator<Long> search(MailboxSession session, Mailbox<Id> mailbox, SearchQuery searchQuery) throws MailboxException
MessageSearchIndex
Mailbox
's which match the SearchQuery
MailboxException
MessageSearchIndex.search(org.apache.james.mailbox.MailboxSession, org.apache.james.mailbox.store.mail.model.Mailbox, org.apache.james.mailbox.model.SearchQuery)
public void add(MailboxSession session, Mailbox<Id> mailbox, Message<Id> membership) throws MailboxException
ListeningMessageSearchIndex
public void update(MailboxSession session, Mailbox<Id> mailbox, MessageRange range, javax.mail.Flags f) throws MailboxException
ListeningMessageSearchIndex
public void delete(MailboxSession session, Mailbox<Id> mailbox, MessageRange range) throws MailboxException
ListeningMessageSearchIndex
MessageRange
for the given Mailbox
from the indexCopyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.