com.atlassian.bamboo.index
Interface IndexerService

All Known Implementing Classes:
IndexerServiceImpl

public interface IndexerService

This service takes care of adding/updating/removing documents from Lucene. All indexers should use it. Implementation will queue requests per connection and will execute them asynchronously in submission order.


Method Summary
 com.google.common.util.concurrent.ListenableFuture addDocument(IndexerContext indexerContext, org.apache.lucene.document.Document document)
          Submit add document request
 com.google.common.util.concurrent.ListenableFuture addDocuments(IndexerContext indexerContext, Iterable<org.apache.lucene.document.Document> documents)
          Submit add documents request
 com.google.common.util.concurrent.ListenableFuture batchUpdate(IndexerContext indexerContext, IndexerTask task)
          Submit batch update request
 IndexerContext createNewIndexerContext(com.atlassian.bonnie.ILuceneConnection connection)
          Create new default indexer context.
 com.google.common.util.concurrent.ListenableFuture deleteDocuments(IndexerContext indexerContext, org.apache.lucene.index.Term term)
          Submit delete documents request
 void flushAndUnlockIndexerQueue(IndexerContext indexerContext)
          Unlock indexer and submit for execution all operations that were queued while index was locked
<T> List<T>
getMatchingDocuments(IndexerContext indexerContext, IndexSearcherTask<T> task)
          Submit a custom search task for execution
 List<org.apache.lucene.document.Document> getMatchingDocuments(IndexerContext indexerContext, org.apache.lucene.search.Query query)
          Submit a document search query
 IndexerContext lockIndexerQueue(com.atlassian.bonnie.ILuceneConnection connection)
          Lock indexer and return a context that will allow executing operations while indexer is locked.
 com.google.common.util.concurrent.ListenableFuture recreateIndexDirectory(IndexerContext indexerContext)
          Submit recreate index directory request
 com.google.common.util.concurrent.ListenableFuture updateDocument(IndexerContext indexerContext, org.apache.lucene.index.Term term, org.apache.lucene.document.Document document)
          Submit update document request
 

Method Detail

createNewIndexerContext

@NotNull
IndexerContext createNewIndexerContext(@NotNull
                                               com.atlassian.bonnie.ILuceneConnection connection)
Create new default indexer context. Operations executed with this context might be queued when indexer is locked.

Parameters:
connection - Lucene connection
Returns:
indexer context

lockIndexerQueue

@NotNull
IndexerContext lockIndexerQueue(@NotNull
                                        com.atlassian.bonnie.ILuceneConnection connection)
Lock indexer and return a context that will allow executing operations while indexer is locked. All operations submitted with returned context will be scheduled for execution immediately, operations submitted with default context will be queued until indexer is unlocked. This is used for reindexing

Parameters:
connection - Lucene connection
Returns:
indexer context

flushAndUnlockIndexerQueue

void flushAndUnlockIndexerQueue(@NotNull
                                IndexerContext indexerContext)
Unlock indexer and submit for execution all operations that were queued while index was locked

Parameters:
indexerContext - indexer context

getMatchingDocuments

@NotNull
List<org.apache.lucene.document.Document> getMatchingDocuments(@NotNull
                                                                       IndexerContext indexerContext,
                                                                       @NotNull
                                                                       org.apache.lucene.search.Query query)
Submit a document search query

Parameters:
indexerContext - indexer context
query - query that will be executed on Lucene connection
Returns:
list of documents matching the query

getMatchingDocuments

@NotNull
<T> List<T> getMatchingDocuments(@NotNull
                                         IndexerContext indexerContext,
                                         @NotNull
                                         IndexSearcherTask<T> task)
Submit a custom search task for execution

Parameters:
indexerContext - indexer context
task - search task to get executed
Returns:
list of documents returned by the tasl

addDocument

@NotNull
com.google.common.util.concurrent.ListenableFuture addDocument(@NotNull
                                                                       IndexerContext indexerContext,
                                                                       @NotNull
                                                                       org.apache.lucene.document.Document document)
Submit add document request

Parameters:
indexerContext - indexer context
document - document to be added to index
Returns:
ListenableFuture that will finish when document is added to index

addDocuments

@NotNull
com.google.common.util.concurrent.ListenableFuture addDocuments(@NotNull
                                                                        IndexerContext indexerContext,
                                                                        @NotNull
                                                                        Iterable<org.apache.lucene.document.Document> documents)
Submit add documents request

Parameters:
indexerContext - indexer context
documents - documents to be added to index
Returns:
ListenableFuture that will finish when all documents is added to index

updateDocument

@NotNull
com.google.common.util.concurrent.ListenableFuture updateDocument(@NotNull
                                                                          IndexerContext indexerContext,
                                                                          @NotNull
                                                                          org.apache.lucene.index.Term term,
                                                                          @NotNull
                                                                          org.apache.lucene.document.Document document)
Submit update document request

Parameters:
indexerContext - indexer context
term - term that identifies document that is about to be updated
document - new document that will be added to index
Returns:
ListenableFuture that will finish when document is update

deleteDocuments

@NotNull
com.google.common.util.concurrent.ListenableFuture deleteDocuments(@NotNull
                                                                           IndexerContext indexerContext,
                                                                           @NotNull
                                                                           org.apache.lucene.index.Term term)
Submit delete documents request

Parameters:
indexerContext - indexer context
term - term that identifies documents to be deleted
Returns:
ListenableFuture that will finish when documents will be deleted

batchUpdate

@NotNull
com.google.common.util.concurrent.ListenableFuture batchUpdate(@NotNull
                                                                       IndexerContext indexerContext,
                                                                       @NotNull
                                                                       IndexerTask task)
Submit batch update request

Parameters:
indexerContext - indexer context
task - task to be executed within ILuceneConnection.withBatchUpdate(com.atlassian.bonnie.ILuceneConnection.BatchUpdateAction)
Returns:
ListenableFuture that will finish when batch update is completed

recreateIndexDirectory

@NotNull
com.google.common.util.concurrent.ListenableFuture recreateIndexDirectory(@NotNull
                                                                                  IndexerContext indexerContext)
Submit recreate index directory request

Parameters:
indexerContext - indexer context
Returns:
ListenableFuture that will finish when request is completed


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.