public class EsIndex extends Object implements ProvidedIndex
Filter.Results
Modifier | Constructor and Description |
---|---|
protected |
EsIndex(EsClient client,
EsIndexColumns columns,
ExecutionContext context,
String name,
String workspace)
Creates new index.
|
|
EsIndex(EsClient client,
ExecutionContext context,
IndexDefinition defn,
String workspace)
Creates new index.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String nodeKey,
String propertyName,
Object value)
Adds a single value to this index for the given node.
|
void |
add(String nodeKey,
String propertyName,
Object[] values)
Adds multiple values to the index for the given node.
|
void |
clearAllData()
Remove all of the index entries from the index.
|
void |
commit()
Commits any potential changes made by the add/remove/update operations to this index.
|
long |
estimateCardinality(List<Constraint> constraints,
Map<String,Object> variables)
Compute the cost applying the given constraints joined together conceptually using AND.
|
long |
estimateTotalCount()
Get the estimated number of entries within this index.
|
Filter.Results |
filter(IndexConstraints constraints)
Return a
Filter.Results instance from which ModeShape can obtain the nodes that satisfy the supplied constraints. |
String |
getName()
Get the name of the index.
|
void |
remove(String nodeKey)
Removes the given node from the index.
|
void |
remove(String nodeKey,
String propertyName,
Object value)
Removes a value for the given node from the index.
|
void |
remove(String nodeKey,
String propertyName,
Object[] values)
Removes multiple values from the index for the given node.
|
boolean |
requiresReindexing()
Return whether this index is newly created and requires reindexing, or false if the index already exists.
|
void |
shutdown(boolean destroyed)
Shut down this index and release all runtime resources.
|
public EsIndex(EsClient client, ExecutionContext context, IndexDefinition defn, String workspace)
client
- provides access to the elasticsearch functions.context
- Modeshape execution context.defn
- index definition.workspace
- workspace name where this index will be created.protected EsIndex(EsClient client, EsIndexColumns columns, ExecutionContext context, String name, String workspace)
client
- provides access to the elasticsearch functions.columns
- columns definition.context
- Modeshape execution context.name
- the name of the indexworkspace
- workspace name where this index will be created.public void add(String nodeKey, String propertyName, Object value)
ProvidedIndex
add
in interface ProvidedIndex
nodeKey
- a NodeKey
instance, never null
propertyName
- the name for which the value is removed, never null
but certain providers
may ignore the value. Most of the times this is the real JCR property name, but for some index types (e.g. node types
index) this may be something else (e.g. the name of the index)value
- an Object instance, never null
public void add(String nodeKey, String propertyName, Object[] values)
ProvidedIndex
add
in interface ProvidedIndex
nodeKey
- a NodeKey
instance, never null
propertyName
- the name for which the value is removed, never null
but certain providers
may ignore the value. Most of the times this is the real JCR property name, but for some index types (e.g. node types
index) this may be something else (e.g. the name of the index)values
- an array of values, never null
or emptypublic void remove(String nodeKey)
ProvidedIndex
remove
in interface ProvidedIndex
nodeKey
- a NodeKey
instance, never null
public void remove(String nodeKey, String propertyName, Object value)
ProvidedIndex
remove
in interface ProvidedIndex
nodeKey
- a NodeKey
instance, never null
propertyName
- the name for which the value is removed, never null
but certain providers
may ignore the value. Most of the times this is the real JCR property name, but for some index types (e.g. node types
index) this may be something else (e.g. the name of the index)value
- the value to remove from the index for this node, never null
public void remove(String nodeKey, String propertyName, Object[] values)
ProvidedIndex
remove
in interface ProvidedIndex
nodeKey
- a NodeKey
instance, never null
propertyName
- the name for which the value is removed, never null
but certain providers
may ignore the value. Most of the times this is the real JCR property name, but for some index types (e.g. node types
index) this may be something else (e.g. the name of the index)values
- the values to remove, never null
or emptypublic void commit()
ProvidedIndex
commit
in interface ProvidedIndex
public String getName()
ProvidedIndex
getName
in interface ProvidedIndex
public Filter.Results filter(IndexConstraints constraints)
Filter
Filter.Results
instance from which ModeShape can obtain the nodes that satisfy the supplied constraints. This
method should return quickly, since no work (or at least very little work) should be done. All of the work should be
performed when the Filter.Results.getNextBatch(ResultWriter, int)
method is called on the results.public long estimateCardinality(List<Constraint> constraints, Map<String,Object> variables)
Costable
estimateCardinality
in interface Costable
constraints
- the constraints; never nullvariables
- the bound variables for the query that is being costed; never nullpublic long estimateTotalCount()
Costable
estimateTotalCount
in interface Costable
public boolean requiresReindexing()
Reindexable
requiresReindexing
in interface Reindexable
public void clearAllData()
Reindexable
clearAllData
in interface Reindexable
public void shutdown(boolean destroyed)
Lifecycle
destroyed
is true
, then this index has been
removed from the repository and will not be reused; thus all persistent resources should also be released. If
destroyed
is false
, then this repository is merely shutting down and the index's persistent resources
should be kept so that they are available when the repository is restarted.shutdown
in interface Lifecycle
destroyed
- true if this index is being permanently removed from the repository and all runtime and persistent
resources can/should be released and cleaned up, or false if the repository is being shutdown and this index will be
needed the next time the repository is startedCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.