|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.storage.NativeValueIndex
Maintains an index on typed node values. TODO: Check correct types during validation. In the BTree single BFile, the keys are : (collectionId, indexType, indexData) and the values are : gid1, gid2-gid1, ...
Algorithm:
When a node is stored, an entry is added or updated in thepending map,
with given String content and basic type as key.
This way, the index entries are easily put in the persistent BFile storage by
flush() .
| Field Summary | |
protected boolean |
caseSensitive
|
protected BFile |
dbValues
The datastore for this value index |
protected java.util.TreeMap |
pending
A collection of key-value pairs that pending modifications for this value index. |
| Constructor Summary | |
NativeValueIndex(DBBroker broker,
BFile dbValues)
|
|
| Method Summary | |
protected int |
checkRelationOp(int relation)
|
boolean |
close()
|
void |
dropIndex(Collection collection)
Drop all index entries for the given collection. |
void |
dropIndex(DocumentImpl document)
Drop all index entries for the given document. |
void |
endElement(int xpathType,
ElementImpl node,
java.lang.String content)
store and index given element (called storeElement before) |
NodeSet |
find(int relation,
DocumentSet docs,
NodeSet contextSet,
Indexable value)
find |
void |
flush()
writes the pending items, for the current document's collection |
NodeSet |
match(DocumentSet docs,
NodeSet contextSet,
java.lang.String expr,
int type)
|
NodeSet |
match(DocumentSet docs,
NodeSet contextSet,
java.lang.String expr,
int type,
int flags,
boolean caseSensitiveQuery)
Regular expression search |
void |
printStatistics()
|
void |
reindex(DocumentImpl document,
StoredNode node)
Reindexes all pending items for the specified document. |
void |
remove()
remove all pending modifications, for the current document. |
void |
removeElement(ElementImpl node,
NodePath currentPath,
java.lang.String content)
Mark given Element for removal; added entries are written to the list of pending entries. |
ValueOccurrences[] |
scanIndexKeys(DocumentSet docs,
NodeSet contextSet,
Indexable start)
|
void |
setDocument(DocumentImpl document)
set the current document; generally called before calling an operation |
void |
startElement(ElementImpl impl,
NodePath currentPath,
boolean index)
corresponds to SAX function of the same name |
void |
storeAttribute(AttrImpl node,
NodePath currentPath,
boolean fullTextIndexSwitch)
store and index given attribute |
void |
storeAttribute(RangeIndexSpec spec,
AttrImpl node)
Store the given attribute's value in the value index. |
void |
storeElement(int xpathType,
ElementImpl node,
java.lang.String content)
Store the given element's value in the value index. |
void |
storeText(TextImpl node,
NodePath currentPath,
boolean fullTextIndexSwitch)
store and index given text node |
void |
sync()
triggers a cache sync, i.e. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected BFile dbValues
protected java.util.TreeMap pending
atomic values
that implement Indexable.
The values are lists containing
the nodes GIDs (global identifiers.
Do not confuse the keys with the ones used in persistent storage, created with
{@link Indexable#serialize(short)
protected boolean caseSensitive
| Constructor Detail |
public NativeValueIndex(DBBroker broker,
BFile dbValues)
| Method Detail |
public void setDocument(DocumentImpl document)
ContentLoadingObserver
setDocument in interface ContentLoadingObserver
public void storeElement(int xpathType,
ElementImpl node,
java.lang.String content)
xpathType - The value typenode - The elementcontent - The string representation of the value
public void storeAttribute(RangeIndexSpec spec,
AttrImpl node)
spec - The index specificationnode - The attribute
public void storeAttribute(AttrImpl node,
NodePath currentPath,
boolean fullTextIndexSwitch)
ContentLoadingObserver
storeAttribute in interface ContentLoadingObserver
public void storeText(TextImpl node,
NodePath currentPath,
boolean fullTextIndexSwitch)
ContentLoadingObserver
storeText in interface ContentLoadingObserver
public void startElement(ElementImpl impl,
NodePath currentPath,
boolean index)
ContentLoadingObserver
startElement in interface ContentLoadingObserver
public void endElement(int xpathType,
ElementImpl node,
java.lang.String content)
ContentLoadingObserver
endElement in interface ContentLoadingObserver
public void removeElement(ElementImpl node,
NodePath currentPath,
java.lang.String content)
ContentLoadingObserverContentLoadingObserver.flush() is called later to flush all pending entries.
removeElement in interface ContentLoadingObserverpublic void sync()
ContentLoadingObserver
sync in interface ContentLoadingObserverpublic void flush()
ContentLoadingObserver
flush in interface ContentLoadingObserverpublic void remove()
ContentLoadingObserver
remove in interface ContentLoadingObserverpublic void dropIndex(Collection collection)
ContentLoadingObserver
dropIndex in interface ContentLoadingObservercollection -
public void dropIndex(DocumentImpl document)
throws ReadOnlyException
ContentLoadingObserver
dropIndex in interface ContentLoadingObserverdocument -
ReadOnlyException
public void reindex(DocumentImpl document,
StoredNode node)
ContentLoadingObserver#addNode(QName, NodeProxy), #storeElement(int, ElementImpl, String),
and {@link #storeAttribute(RangeIndexSpec, AttrImpl)}. Method reindex then scans this
list and updates the items in the index to reflect the reindexed document.
reindex in interface ContentLoadingObserverdocument - the document to be reindexed.node - if != null, only nodes being descendants of the specified node will be
reindexed. Other nodes are not touched. This is used for a partial reindex.
public NodeSet find(int relation,
DocumentSet docs,
NodeSet contextSet,
Indexable value)
throws TerminatedException
relation - binary operator used for the comparisonvalue - right hand comparison value
TerminatedException
public NodeSet match(DocumentSet docs,
NodeSet contextSet,
java.lang.String expr,
int type)
throws TerminatedException,
EXistException
TerminatedException
EXistException
public NodeSet match(DocumentSet docs,
NodeSet contextSet,
java.lang.String expr,
int type,
int flags,
boolean caseSensitiveQuery)
throws TerminatedException,
EXistException
type - like type argument for RegexMatcher constructorflags - like flags argument for RegexMatcher constructor
TerminatedException
EXistException
public ValueOccurrences[] scanIndexKeys(DocumentSet docs,
NodeSet contextSet,
Indexable start)
protected int checkRelationOp(int relation)
public boolean close()
throws DBException
DBExceptionpublic void printStatistics()
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||