Package org.nuxeo.elasticsearch.commands
Class IndexingCommand
java.lang.Object
org.nuxeo.elasticsearch.commands.IndexingCommand
- All Implemented Interfaces:
Serializable
Holds information about what type of indexing operation must be processed. IndexingCommands are create "on the fly"
via a Synchronous event listener and at post commit time the system will merge the commands and execute worker to
process them.
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected long
protected String
static final String
protected boolean
protected String
protected static AtomicLong
protected boolean
protected String
protected IndexingCommand.Type
-
Constructor Summary
ModifierConstructorDescriptionprotected
IndexingCommand
(DocumentModel document, IndexingCommand.Type commandType, boolean sync, boolean recurse) Create an indexing command -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSchemas
(String schema) void
attach
(CoreSession session) protected boolean
canBeMerged
(IndexingCommand other) clone
(DocumentModel newDoc) static IndexingCommand
fromJSON
(com.fasterxml.jackson.databind.JsonNode jsonNode) static IndexingCommand
Create a command from a JSON string.getId()
long
getOrder()
String[]
Return the document or null if it does not exists anymore.getType()
protected DocumentModel
getValidTargetDocument
(DocumentModel target) boolean
boolean
isSync()
void
makeSync()
Try to make the command synchronous.protected void
merge
(boolean sync, boolean recurse) boolean
merge
(IndexingCommand other) void
setOrder
(long order) toJSON()
void
toJSON
(com.fasterxml.jackson.core.JsonGenerator jsonGen) toString()
-
Field Details
-
PREFIX
- See Also:
-
id
-
type
-
sync
protected boolean sync -
recurse
protected boolean recurse -
targetDocumentId
-
path
-
repositoryName
-
schemas
-
order
protected long order -
seq
-
-
Constructor Details
-
IndexingCommand
protected IndexingCommand() -
IndexingCommand
public IndexingCommand(DocumentModel document, IndexingCommand.Type commandType, boolean sync, boolean recurse) Create an indexing command- Parameters:
document
- the target documentcommandType
- the type of commandsync
- if true the command will be processed on the same thread after transaction completion and the Elasticsearch index will be refreshrecurse
- the command affect the document and all its descendants
-
-
Method Details
-
getValidTargetDocument
-
attach
-
getTargetDocument
Return the document or null if it does not exists anymore.- Throws:
IllegalStateException
- if there is no session attached
-
getRepositoryName
-
merge
- Returns:
- true if merged
-
merge
protected void merge(boolean sync, boolean recurse) -
canBeMerged
-
isSync
public boolean isSync() -
isRecurse
public boolean isRecurse() -
getType
-
toJSON
- Throws:
IOException
-
toJSON
- Throws:
IOException
-
fromJSON
Create a command from a JSON string.- Throws:
IllegalArgumentException
- if json is invalid or command is invalid
-
fromJSON
-
getId
-
getTargetDocumentId
-
clone
-
getSchemas
-
addSchemas
-
toString
-
makeSync
public void makeSync()Try to make the command synchronous. Recurse command will stay in async for update. -
getOrder
public long getOrder() -
setOrder
public void setOrder(long order)
-