public final class IndexingSupport extends Object
Modifier and Type | Method and Description |
---|---|
void |
addDocument(IndexDocument document)
Adds a new
IndexDocument into the index |
IndexDocument |
createDocument(FileObject file)
Creates a new
IndexDocument . |
IndexDocument |
createDocument(Indexable indexable)
Creates a new
IndexDocument . |
static IndexingSupport |
getInstance(Context context)
Returns an
IndexingSupport for given indexing Context |
boolean |
isValid()
Checks a validity of the index
Implementations of the |
void |
markDirtyDocuments(Indexable indexable)
Marks all documents for an
Indexable as dirty. |
void |
removeDocuments(Indexable indexable)
Removes all documents for given indexables
|
@NonNull public static IndexingSupport getInstance(@NonNull Context context) throws IOException
IndexingSupport
for given indexing Context
context
- for which the support should be returnedIOException
- when underlying storage is corrupted or cannot
be createdpublic boolean isValid()
Implementations of the SourceIndexerFactory
should check the validity of the
index in the SourceIndexerFactory.scanStarted(org.netbeans.modules.parsing.spi.indexing.Context)
method
and force reindexing of the root for which the index is broken. In case of CSL based factories the check is done by the CSL itself.
@NonNull public IndexDocument createDocument(@NonNull FileObject file)
IndexDocument
. This method does exactly the same as
{@link #createDocument(org.netbeans.modules.parsing.spi.indexing.Indexable), but you can
use FileObject
s directly. The FileObject
passed in
as a parameter has to be in the folders hierarchy under the root, which
this IndexingSupport
instance was created for.file
- The file to create IndexDocument
for.IndexDocument
created for the file
.public IndexDocument createDocument(Indexable indexable)
IndexDocument
.public void addDocument(IndexDocument document)
IndexDocument
into the indexdocument
- to be addedpublic void removeDocuments(Indexable indexable)
indexable
- to be removedpublic void markDirtyDocuments(Indexable indexable)
Indexable
as dirty. Any subsequent
use of QuerySupport
for those Indexable
s will first
refresh the documents (ie. call indexers) to make sure that the documents
are up-to-date.indexable
- The Indexable
whose documents will be marked as dirty.