public class DefaultIndexingContext extends AbstractIndexingContext
IndexingContext implementation.| Modifier and Type | Field and Description |
|---|---|
static boolean |
BLOCKING_COMMIT
A flag useful for tests, to make this IndexingContext implementation blocking.
|
static String |
FLD_DESCRIPTOR |
INDEX_CHAIN_ID, INDEX_CHUNK_COUNTER, INDEX_CHUNK_PREFIX, INDEX_FILE_PREFIX, INDEX_ID, INDEX_LEGACY_TIMESTAMP, INDEX_PACKER_PROPERTIES_FILE, INDEX_PROPERTY_PREFIX, INDEX_REMOTE_PROPERTIES_FILE, INDEX_TIME_DAY_FORMAT, INDEX_TIME_FORMAT, INDEX_TIMESTAMP, INDEX_UPDATER_PROPERTIES_FILE| Constructor and Description |
|---|
DefaultIndexingContext(String id,
String repositoryId,
File repository,
org.apache.lucene.store.Directory indexDirectory,
String repositoryUrl,
String indexUpdateUrl,
List<? extends IndexCreator> indexCreators,
boolean reclaimIndex) |
DefaultIndexingContext(String id,
String repositoryId,
File repository,
File indexDirectoryFile,
String repositoryUrl,
String indexUpdateUrl,
List<? extends IndexCreator> indexCreators,
boolean reclaimIndex) |
| Modifier and Type | Method and Description |
|---|---|
void |
close(boolean deleteFiles)
Shuts down this context.
|
void |
commit()
Commits changes to context, eventually refreshing readers/searchers too.
|
protected org.apache.lucene.document.Document |
createGroupsDocument(Collection<String> groups,
String field,
String fieldValue,
String listField) |
protected void |
doCommit(boolean blocking) |
protected void |
flagNeedsReopen() |
Set<String> |
getAllGroups()
Gets all group names stored in the current indexing context
|
org.apache.lucene.analysis.Analyzer |
getAnalyzer()
Returns the Lucene Analyzer of this context used for by IndexWriter and IndexSearcher.
|
GavCalculator |
getGavCalculator()
Returns the GavCalculator for this Context.
|
protected Set<String> |
getGroups(String field,
String filedValue,
String listField) |
String |
getId()
Returns this indexing context id.
|
List<IndexCreator> |
getIndexCreators()
List of IndexCreators used in this context.
|
org.apache.lucene.store.Directory |
getIndexDirectory() |
File |
getIndexDirectoryFile() |
org.apache.lucene.index.IndexReader |
getIndexReader()
Returns the Lucene IndexReader of this context.
|
org.apache.lucene.search.IndexSearcher |
getIndexSearcher()
Returns the Lucene IndexSearcher of this context.
|
String |
getIndexUpdateUrl()
Returns url for the index update
|
org.apache.lucene.index.IndexWriter |
getIndexWriter()
Returns the Lucene IndexWriter of this context.
|
File |
getRepository()
Returns location for the local repository.
|
String |
getRepositoryId()
Returns repository id.
|
String |
getRepositoryUrl()
Returns public repository url.
|
Set<String> |
getRootGroups()
Gets root group names stored in the current indexing context
|
int |
getSize()
Returns a number that represents the "size" useful for doing comparisons between contexts (which one has more
data indexed?).
|
Date |
getTimestamp()
Returns index update time
|
protected void |
installBottleWarmer() |
protected boolean |
isReopenNeeded() |
boolean |
isSearchable()
Is the context searchable when doing "non-targeted" searches? Ie.
|
void |
lock()
Performs a shared locking on this context, guaranteeing that no IndexReader/Searcher/Writer close will occur.
|
void |
lockExclusively() |
void |
merge(org.apache.lucene.store.Directory directory)
Merges content of given Lucene directory with this context.
|
void |
merge(org.apache.lucene.store.Directory directory,
DocumentFilter filter)
Merges content of given Lucene directory with this context, but filters out the unwanted ones.
|
protected void |
openAndWarmup() |
protected void |
openAndWarmupReaders() |
void |
optimize()
Optimizes index
|
void |
purge()
Purge (cleans) the context, deletes/empties the index and restores the context to new/empty state.
|
void |
rebuildGroups()
Rebuilds stored group names from the index
|
void |
replace(org.apache.lucene.store.Directory directory)
Replaces the Lucene index with the one from supplied directory.
|
void |
rollback()
Rolls back changes to context, eventually refreshing readers/searchers too.
|
void |
setAllGroups(Collection<String> groups)
Sets all group names stored in the current indexing context
|
protected void |
setGroups(Collection<String> groups,
String groupField,
String groupFieldValue,
String groupListField) |
void |
setRootGroups(Collection<String> groups)
Sets root group names stored in the current indexing context
|
void |
setSearchable(boolean searchable)
Sets is the context searchable when doing "non-targeted" searches.
|
String |
toString() |
protected void |
unflagNeedsReopen() |
void |
unlock()
Releases the shared lock on this context.
|
void |
unlockExclusively() |
void |
updateTimestamp() |
void |
updateTimestamp(boolean save) |
void |
updateTimestamp(boolean save,
Date timestamp) |
protected void |
warmUp(NexusIndexSearcher searcher) |
isReceivingUpdatespublic static final String FLD_DESCRIPTOR
public static boolean BLOCKING_COMMIT
public DefaultIndexingContext(String id, String repositoryId, File repository, File indexDirectoryFile, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexCreators, boolean reclaimIndex) throws IOException, UnsupportedExistingLuceneIndexException
public DefaultIndexingContext(String id, String repositoryId, File repository, org.apache.lucene.store.Directory indexDirectory, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexCreators, boolean reclaimIndex) throws IOException, UnsupportedExistingLuceneIndexException
public void lock()
IndexingContextpublic void unlock()
IndexingContextpublic void lockExclusively()
public void unlockExclusively()
public org.apache.lucene.store.Directory getIndexDirectory()
public File getIndexDirectoryFile()
public boolean isSearchable()
IndexingContextpublic void setSearchable(boolean searchable)
IndexingContextpublic String getId()
IndexingContextpublic void updateTimestamp()
throws IOException
IOExceptionpublic void updateTimestamp(boolean save)
throws IOException
IOExceptionpublic void updateTimestamp(boolean save,
Date timestamp)
throws IOException
IOExceptionpublic Date getTimestamp()
IndexingContextpublic int getSize()
throws IOException
IndexingContextIOExceptionpublic String getRepositoryId()
IndexingContextpublic File getRepository()
IndexingContextpublic String getRepositoryUrl()
IndexingContextpublic String getIndexUpdateUrl()
IndexingContextpublic org.apache.lucene.analysis.Analyzer getAnalyzer()
IndexingContextprotected void openAndWarmup()
throws IOException
IOExceptionprotected void openAndWarmupReaders()
throws IOException
IOExceptionprotected void warmUp(NexusIndexSearcher searcher) throws IOException
IOExceptionpublic org.apache.lucene.index.IndexWriter getIndexWriter()
throws IOException
IndexingContextIOExceptionpublic org.apache.lucene.index.IndexReader getIndexReader()
throws IOException
IndexingContextIOExceptionpublic org.apache.lucene.search.IndexSearcher getIndexSearcher()
throws IOException
IndexingContextIOExceptionpublic void commit()
throws IOException
IndexingContextIOExceptionprotected void doCommit(boolean blocking)
throws IOException
IOExceptionpublic void rollback()
throws IOException
IndexingContextIOExceptionpublic void optimize()
throws org.apache.lucene.index.CorruptIndexException,
IOException
IndexingContextorg.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic void close(boolean deleteFiles)
throws IOException
IndexingContextIOExceptionpublic void purge()
throws IOException
IndexingContextIOExceptionpublic void replace(org.apache.lucene.store.Directory directory)
throws IOException
IndexingContextIOExceptionpublic void merge(org.apache.lucene.store.Directory directory)
throws IOException
IndexingContextdirectory - - the directory to mergeIOExceptionpublic void merge(org.apache.lucene.store.Directory directory,
DocumentFilter filter)
throws IOException
IndexingContextdirectory - - the directory to mergeIOExceptionpublic GavCalculator getGavCalculator()
IndexingContextpublic List<IndexCreator> getIndexCreators()
IndexingContextpublic void rebuildGroups()
throws IOException
IndexingContextIOExceptionpublic Set<String> getAllGroups() throws IOException
IndexingContextIOExceptionpublic void setAllGroups(Collection<String> groups) throws IOException
IndexingContextIOExceptionpublic Set<String> getRootGroups() throws IOException
IndexingContextIOExceptionpublic void setRootGroups(Collection<String> groups) throws IOException
IndexingContextIOExceptionprotected Set<String> getGroups(String field, String filedValue, String listField) throws IOException, org.apache.lucene.index.CorruptIndexException
IOExceptionorg.apache.lucene.index.CorruptIndexExceptionprotected void setGroups(Collection<String> groups, String groupField, String groupFieldValue, String groupListField) throws IOException, org.apache.lucene.index.CorruptIndexException
IOExceptionorg.apache.lucene.index.CorruptIndexExceptionprotected org.apache.lucene.document.Document createGroupsDocument(Collection<String> groups, String field, String fieldValue, String listField)
protected void flagNeedsReopen()
protected void unflagNeedsReopen()
protected boolean isReopenNeeded()
protected void installBottleWarmer()
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.