|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.indexing.IndexController
public class IndexController
Internally used to dispatch an operation to each of the
registered indexes. An IndexController instance can be
retrieved via DBBroker.getIndexController()
.
Constructor Summary | |
---|---|
IndexController(DBBroker broker)
|
Method Summary | |
---|---|
void |
addIndexWorker(IndexWorker worker)
TODO: temporary method to plug in fulltext index. |
void |
attribute(Txn transaction,
AttrImpl node,
NodePath path,
StreamListener listener)
Helper method: index a single attribute node which has been added during an XUpdate or XQuery update expression. |
void |
characters(Txn transaction,
TextImpl node,
NodePath path,
StreamListener listener)
Helper method: index a single text node which has been added during an XUpdate or XQuery update expression. |
Map |
configure(NodeList configNodes,
Map namespaces)
Configures all index workers registered with the db instance. |
void |
endElement(Txn transaction,
ElementImpl node,
NodePath path,
StreamListener listener)
Helper method: dispatch a single endElement event to the specified listener. |
void |
flush()
Flushes all index workers. |
DocumentImpl |
getDocument()
Returns the document for the next operation. |
MatchListener |
getMatchListener(NodeProxy proxy)
Returns the match listener for this node. |
int |
getMode()
Returns the mode for the next operation. |
StoredNode |
getReindexRoot(StoredNode node,
NodePath path)
When adding or removing nodes to or from the document tree, it might become necessary to reindex some parts of the tree, in particular if indexes are defined on mixed content nodes. |
StoredNode |
getReindexRoot(StoredNode node,
NodePath path,
boolean includeSelf)
When adding or removing nodes to or from the document tree, it might become necessary to reindex some parts of the tree, in particular if indexes are defined on mixed content nodes. |
StreamListener |
getStreamListener()
Returns a chain of StreamListener , one
for each index configured on the current document for the current mode. |
IndexWorker |
getWorkerByIndexId(String indexId)
Returns an IndexWorker instance corresponding
to the specified type of index in indexId. |
IndexWorker |
getWorkerByIndexName(String indexName)
Returns an IndexWorker instance corresponding
to the specified index named by indexName. |
void |
indexNode(Txn transaction,
StoredNode node,
NodePath path,
StreamListener listener)
Helper method: index a single node which has been added during an XUpdate or XQuery update expression. |
void |
reindex(Txn transaction,
StoredNode reindexRoot,
int mode)
Reindex all nodes below the specified root node, using the given mode. |
void |
removeCollection(Collection collection,
DBBroker broker)
Remove all indexes defined on the specified collection. |
void |
setDocument(DocumentImpl doc)
Sets the document for the next operation. |
void |
setDocument(DocumentImpl doc,
int mode)
Sets the document and the mode for the next operation. |
void |
setMode(int mode)
Sets the the mode for the next operation. |
void |
startElement(Txn transaction,
ElementImpl node,
NodePath path,
StreamListener listener)
Helper method: index a single element node which has been added during an XUpdate or XQuery update expression. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IndexController(DBBroker broker)
Method Detail |
---|
public void addIndexWorker(IndexWorker worker)
worker
- public Map configure(NodeList configNodes, Map namespaces) throws DatabaseConfigurationException
configNodes
- lists the top-level child nodes below the <index> element in collection.xconfnamespaces
- the active prefix/namespace map
DatabaseConfigurationException
- if a configuration error occurspublic IndexWorker getWorkerByIndexId(String indexId)
IndexWorker
instance corresponding
to the specified type of index in indexId. The indexId should be the same one
as returned by IndexWorker.getIndexId()
.
indexId
-
public IndexWorker getWorkerByIndexName(String indexName)
IndexWorker
instance corresponding
to the specified index named by indexName. The indexName should be the same one
as returned by IndexWorker.getIndexName()
.
indexName
-
public void setDocument(DocumentImpl doc)
doc
- the documentpublic void setMode(int mode)
mode
- the mode, one of StreamListener.UNKNOWN
, StreamListener.STORE
,
StreamListener.REMOVE_SOME_NODES
or StreamListener.REMOVE_ALL_NODES
.public DocumentImpl getDocument()
public int getMode()
public void setDocument(DocumentImpl doc, int mode)
doc
- the documentmode
- the mode, one of StreamListener.UNKNOWN
, StreamListener.STORE
,
StreamListener.REMOVE_SOME_NODES
or StreamListener.REMOVE_ALL_NODES
.public void flush()
public void removeCollection(Collection collection, DBBroker broker)
collection
- the collection to removebroker
- the broker that will perform the operationpublic void reindex(Txn transaction, StoredNode reindexRoot, int mode)
transaction
- the current transactionreindexRoot
- the node from which reindexing should occurmode
- the mode, one of StreamListener.UNKNOWN
, StreamListener.STORE
,
StreamListener.REMOVE_SOME_NODES
or StreamListener.REMOVE_ALL_NODES
.public StoredNode getReindexRoot(StoredNode node, NodePath path)
IndexWorker.getReindexRoot(org.exist.dom.StoredNode, org.exist.storage.NodePath, boolean)
on each configured index. It will then return the top-most root.
node
- the node to be modified.path
- the NodePath of the node
public StoredNode getReindexRoot(StoredNode node, NodePath path, boolean includeSelf)
IndexWorker.getReindexRoot(org.exist.dom.StoredNode, org.exist.storage.NodePath, boolean)
on each configured index. It will then return the top-most root.
node
- the node to be modified.path
- path the NodePath of the nodeincludeSelf
- if set to true, the current node itself will be included in the check
public StreamListener getStreamListener()
StreamListener
, one
for each index configured on the current document for the current mode.
Note that the chain is reinitialized when the operating mode changes.
That allows workers to return different StreamListener
for each mode.
public void indexNode(Txn transaction, StoredNode node, NodePath path, StreamListener listener)
transaction
- the current transactionnode
- the node to indexpath
- the node's NodePathlistener
- the StreamListener which receives the index eventspublic void startElement(Txn transaction, ElementImpl node, NodePath path, StreamListener listener)
transaction
- the current transactionnode
- the node to indexpath
- the node's NodePathlistener
- the StreamListener which receives the index eventspublic void endElement(Txn transaction, ElementImpl node, NodePath path, StreamListener listener)
transaction
- the current transactionnode
- the node to indexpath
- the node's NodePathlistener
- the StreamListener which receives index eventspublic void attribute(Txn transaction, AttrImpl node, NodePath path, StreamListener listener)
transaction
- the current transactionnode
- the node to indexpath
- the node's NodePathlistener
- the StreamListener which receives the index eventspublic void characters(Txn transaction, TextImpl node, NodePath path, StreamListener listener)
transaction
- the current transactionnode
- the node to indexpath
- the node's NodePathlistener
- the StreamListener which receives the index eventspublic MatchListener getMatchListener(NodeProxy proxy)
proxy
- a proxy to the node.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |