public class MergedIndexingContext extends AbstractIndexingContext
Modifier and Type | Field and Description |
---|---|
private org.apache.lucene.store.Directory |
directory |
private java.io.File |
directoryFile |
private GavCalculator |
gavCalculator |
private java.lang.String |
id |
private ContextMemberProvider |
membersProvider |
private java.io.File |
repository |
private java.lang.String |
repositoryId |
private boolean |
searchable |
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
Modifier | Constructor and Description |
---|---|
private |
MergedIndexingContext(ContextMemberProvider membersProvider,
java.lang.String id,
java.lang.String repositoryId,
java.io.File repository,
org.apache.lucene.store.Directory indexDirectory,
boolean searchable) |
|
MergedIndexingContext(java.lang.String id,
java.lang.String repositoryId,
java.io.File repository,
org.apache.lucene.store.Directory indexDirectory,
boolean searchable,
ContextMemberProvider membersProvider)
Deprecated.
|
|
MergedIndexingContext(java.lang.String id,
java.lang.String repositoryId,
java.io.File repository,
java.io.File indexDirectoryFile,
boolean searchable,
ContextMemberProvider membersProvider) |
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.search.IndexSearcher |
acquireIndexSearcher()
Acquires a fresh instance of
IndexSearcher . |
void |
close(boolean deleteFiles)
Shuts down this context.
|
void |
commit()
Commits changes to context, eventually refreshing readers/searchers too.
|
java.util.Set<java.lang.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.
|
java.lang.String |
getId()
Returns this indexing context id.
|
java.util.List<IndexCreator> |
getIndexCreators()
List of IndexCreators used in this context.
|
org.apache.lucene.store.Directory |
getIndexDirectory() |
java.io.File |
getIndexDirectoryFile() |
java.lang.String |
getIndexUpdateUrl()
Returns url for the index update
|
org.apache.lucene.index.IndexWriter |
getIndexWriter()
Returns the Lucene IndexWriter (thread safe, shared instance) of this context.
|
java.util.Collection<IndexingContext> |
getMembers() |
java.io.File |
getRepository()
Returns location for the local repository.
|
java.lang.String |
getRepositoryId()
Returns repository id.
|
java.lang.String |
getRepositoryUrl()
Returns public repository url.
|
java.util.Set<java.lang.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?).
|
java.util.Date |
getTimestamp()
Returns index update time
|
boolean |
isSearchable()
Is the context searchable when doing "non-targeted" searches? Ie.
|
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.
|
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 |
releaseIndexSearcher(org.apache.lucene.search.IndexSearcher indexSearcher)
Releases the
IndexSearcher instance. |
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(java.util.Collection<java.lang.String> groups)
Sets all group names stored in the current indexing context
|
void |
setRootGroups(java.util.Collection<java.lang.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.
|
void |
updateTimestamp() |
void |
updateTimestamp(boolean save) |
void |
updateTimestamp(boolean save,
java.util.Date date) |
isReceivingUpdates
private final java.lang.String id
private final java.lang.String repositoryId
private final java.io.File repository
private final ContextMemberProvider membersProvider
private final GavCalculator gavCalculator
private final org.apache.lucene.store.Directory directory
private java.io.File directoryFile
private boolean searchable
private MergedIndexingContext(ContextMemberProvider membersProvider, java.lang.String id, java.lang.String repositoryId, java.io.File repository, org.apache.lucene.store.Directory indexDirectory, boolean searchable) throws java.io.IOException
java.io.IOException
public MergedIndexingContext(java.lang.String id, java.lang.String repositoryId, java.io.File repository, java.io.File indexDirectoryFile, boolean searchable, ContextMemberProvider membersProvider) throws java.io.IOException
java.io.IOException
@Deprecated public MergedIndexingContext(java.lang.String id, java.lang.String repositoryId, java.io.File repository, org.apache.lucene.store.Directory indexDirectory, boolean searchable, ContextMemberProvider membersProvider) throws java.io.IOException
java.io.IOException
public java.util.Collection<IndexingContext> getMembers()
public java.lang.String getId()
IndexingContext
public java.lang.String getRepositoryId()
IndexingContext
public java.io.File getRepository()
IndexingContext
public java.lang.String getRepositoryUrl()
IndexingContext
public java.lang.String getIndexUpdateUrl()
IndexingContext
public boolean isSearchable()
IndexingContext
public void setSearchable(boolean searchable)
IndexingContext
public java.util.Date getTimestamp()
IndexingContext
public void updateTimestamp() throws java.io.IOException
java.io.IOException
public void updateTimestamp(boolean save) throws java.io.IOException
java.io.IOException
public void updateTimestamp(boolean save, java.util.Date date) throws java.io.IOException
java.io.IOException
public int getSize() throws java.io.IOException
IndexingContext
java.io.IOException
public org.apache.lucene.search.IndexSearcher acquireIndexSearcher() throws java.io.IOException
IndexingContext
IndexSearcher
. You have to release the received instance with
IndexingContext.releaseIndexSearcher(IndexSearcher)
otherwise you are about to introduce leak.java.io.IOException
public void releaseIndexSearcher(org.apache.lucene.search.IndexSearcher indexSearcher) throws java.io.IOException
IndexingContext
IndexSearcher
instance.java.io.IOException
public org.apache.lucene.index.IndexWriter getIndexWriter() throws java.io.IOException
IndexingContext
java.io.IOException
public java.util.List<IndexCreator> getIndexCreators()
IndexingContext
public org.apache.lucene.analysis.Analyzer getAnalyzer()
IndexingContext
public void commit() throws java.io.IOException
IndexingContext
java.io.IOException
public void rollback() throws java.io.IOException
IndexingContext
java.io.IOException
public void optimize() throws java.io.IOException
IndexingContext
java.io.IOException
public void close(boolean deleteFiles) throws java.io.IOException
IndexingContext
java.io.IOException
public void purge() throws java.io.IOException
IndexingContext
java.io.IOException
public void merge(org.apache.lucene.store.Directory directory) throws java.io.IOException
IndexingContext
directory
- - the directory to mergejava.io.IOException
public void merge(org.apache.lucene.store.Directory directory, DocumentFilter filter) throws java.io.IOException
IndexingContext
directory
- - the directory to mergejava.io.IOException
public void replace(org.apache.lucene.store.Directory directory) throws java.io.IOException
IndexingContext
java.io.IOException
public org.apache.lucene.store.Directory getIndexDirectory()
public java.io.File getIndexDirectoryFile()
public GavCalculator getGavCalculator()
IndexingContext
public void setAllGroups(java.util.Collection<java.lang.String> groups) throws java.io.IOException
IndexingContext
java.io.IOException
public java.util.Set<java.lang.String> getAllGroups() throws java.io.IOException
IndexingContext
java.io.IOException
public void setRootGroups(java.util.Collection<java.lang.String> groups) throws java.io.IOException
IndexingContext
java.io.IOException
public java.util.Set<java.lang.String> getRootGroups() throws java.io.IOException
IndexingContext
java.io.IOException
public void rebuildGroups() throws java.io.IOException
IndexingContext
java.io.IOException