public abstract class LuceneIndex<T extends com.tinkerpop.blueprints.Element> extends java.lang.Object implements OracleIndex<T>
EDGE_ID_PROP, EDGE_LABEL_PROP, END_NODE_ID_PROP, m_dtValues, START_NODE_ID_PROP, TYPE_DT_BOOL, TYPE_DT_BYTE, TYPE_DT_CHAR, TYPE_DT_DATE, TYPE_DT_DOUBLE, TYPE_DT_FLOAT, TYPE_DT_INTEGER, TYPE_DT_JSON, TYPE_DT_LONG, TYPE_DT_SERIALIZABLE, TYPE_DT_SHORT, TYPE_DT_SPATIAL, TYPE_DT_STRING, TYPE_DT_URI, VERTEX_ID_PROP| Modifier and Type | Method and Description |
|---|---|
void |
add(T element)
Adds a new Element into the Element Index
|
java.lang.String |
appendDatatypesSuffixToKey(java.lang.String key, java.lang.Class dtValue)
This operation will append the data type suffix to the key based on the LuceneIndex configuration.
|
java.lang.String |
appendDatatypesSuffixToValue(java.lang.Object value, java.lang.Class dtValue)
This operation will append the data type suffix to the String representation of the given value based on the LuceneIndex configuration.
|
java.lang.String |
buildSearchTerm(java.lang.String key, java.lang.Object value)
Builds a search term query expression in the syntax required by this index.
|
java.lang.String |
buildSearchTerm(java.lang.String key, java.lang.Object value, java.lang.Class dtValue)
Builds a search term query expression in the syntax required by this index.
|
org.apache.lucene.index.Term |
buildSearchTermObject(java.lang.String key, java.lang.Object value, java.lang.Class dtValue)
Builds a Term object using the given key/Value pair by transforming the K/V into a query expression in the syntax required by this index.
|
void |
clearIndex()
Clears all data stored in the index.
|
void |
close()
Closes this LuceneIndex object
|
void |
commit()
Commit changes
|
long |
count(java.lang.String key, java.lang.Object value)
Counts all the matching elements that have a particular key/value property within the index
|
long |
count(java.lang.String key, java.lang.Object value, boolean acceptWildcard)
Counts all the matching elements that have a particular key/value property within the index
|
long |
count(java.lang.String key, java.lang.Object value, java.lang.Class dtValue, boolean acceptWildcard)
Counts all the matching elements that have a particular key/value property within the index
|
void |
dropIndex()
Clears all data stored in the index.
|
abstract com.tinkerpop.blueprints.CloseableIterable<T> |
get(java.lang.Object query)
Gets an Iterable object with all the matching elements that match the given query object.
|
com.tinkerpop.blueprints.CloseableIterable<T> |
get(java.lang.String key, java.lang.Object value)
Gets an Iterable object with all the matching elements that have a particular key/value property within the index
|
com.tinkerpop.blueprints.CloseableIterable<T> |
get(java.lang.String key, java.lang.Object value, boolean acceptWildcard)
Gets an Iterable object with all the matching elements that have a particular key/value property within the index
|
abstract com.tinkerpop.blueprints.CloseableIterable<T> |
get(java.lang.String key, java.lang.Object value, java.lang.Class dtValue, boolean acceptWildcard)
Gets an Iterable object with all the matching elements that have a particular key/value property within the index
|
org.apache.lucene.store.Directory |
getDirectory(int index)
Get a
Directory object for the specified subdirectory ID. |
java.lang.String |
getDirectoryName()
Gets the directory name for this index.
|
java.lang.String |
getDocIdentifier()
Get index document's identifier.
|
java.lang.String |
getGraphName()
Get the name of the associated graph
|
java.lang.Class<T> |
getIndexClass()
Gets the class associated to this index
|
java.lang.String |
getIndexName()
Gets the name of this index instance.
|
LuceneParameters |
getIndexParameters()
Gets the index parameters associated to this index.
|
OracleDirectory |
getOracleDirectory()
Gets the Oracle Directory storing all index data.
|
OracleIndexParameters |
getOracleIndexParameters()
Gets the OracleIndexParameters associated to this index
|
org.apache.lucene.search.SearcherManager |
getOracleSearcherManager(int index)
Gets the SearcherManager object that executes read operations over the index stored in the specified directory without looking in the SearcherManager cache
|
org.apache.lucene.search.SearcherManager |
getOracleSearcherManager(int index, boolean useCache)
Gets the SearcherManager object that executes read operations over the index stored in the specified directory.
|
com.tinkerpop.blueprints.Parameter<java.lang.String,java.lang.Object>[] |
getParameters()
Gets the Parameters associated to this index.
|
abstract com.tinkerpop.blueprints.CloseableIterable<T>[] |
getPartitioned(java.lang.Object[] connections, java.lang.Object query, int startShardId)
Gets an array of
CloseableIterable objects that hold all the elements with an attribute matching the Query object. |
com.tinkerpop.blueprints.CloseableIterable<T>[] |
getPartitioned(java.lang.Object[] connections, java.lang.String key, java.lang.Object value, boolean acceptWildcard, int startShardId)
Gets an array of
CloseableIterable objects that hold all the elements with an attribute matching the given K/V pair. |
abstract com.tinkerpop.blueprints.CloseableIterable<T>[] |
getPartitioned(java.lang.Object[] connections, java.lang.String key, java.lang.Object value, java.lang.Class dtValue, boolean acceptWildcard, int startShardId)
Gets an array of
CloseableIterable objects that hold all the elements with an attribute matching the given K/V pair. |
org.apache.lucene.search.SearcherFactory |
getSearcherFactory()
Gets the searcher factory associated to this index
|
int |
getTotalShards()
Gets the number of shards (sub-directories) in this index.
|
boolean |
isAutoIndex()
Returns true if this is an auto index
|
void |
put(java.lang.String key, java.lang.Object value, T element)
Indexes an element by a key and a value.
|
void |
put(java.lang.String key, java.lang.Object value, T element, OracleIndexWriter[] indexWriters)
Indexes an element by a key and a value.
|
com.tinkerpop.blueprints.CloseableIterable<T> |
query(java.lang.String key, java.lang.Object value)
Query for all the elements satisfying the specified K/V property within the index
|
com.tinkerpop.blueprints.CloseableIterable<T> |
query(java.lang.String key, java.lang.Object value, boolean useWildcards)
Query for all the elements satisfying the specified K/V property within the index
|
void |
remove(java.lang.String key, java.lang.Object value, java.lang.Class dtValue, T element, OracleIndexWriter[] indexWriters)
Removes an element indexed by a particular key/value.
|
void |
remove(java.lang.String key, java.lang.Object value, T element)
Removes an element indexed by a particular key/value.
|
void |
remove(java.lang.String key, java.lang.Object value, T element, OracleIndexWriter[] indexWriters)
Removes an element indexed by a particular key/value.
|
void |
remove(T element)
Deletes a element from this index
|
void |
removeAll(java.lang.String key)
Removes all the elements from the index matching the specified key.
|
void |
removeAll(java.lang.String key, OracleIndexWriter[] indexWriters)
Removes all the elements from the index matching the specified key.
|
public void add(T element)
add in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>element - an Element object.java.io.IOException
public java.lang.String appendDatatypesSuffixToKey(java.lang.String key,
java.lang.Class dtValue)
key - the key of the K/V propertydtValue - the data type of the value object
public java.lang.String appendDatatypesSuffixToValue(java.lang.Object value,
java.lang.Class dtValue)
value - the value of the K/V propertydtValue - the data type of the value object
public java.lang.String buildSearchTerm(java.lang.String key,
java.lang.Object value)
buildSearchTerm in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the key of the K/V propertyvalue - the value object of the K/V property
public java.lang.String buildSearchTerm(java.lang.String key,
java.lang.Object value,
java.lang.Class dtValue)
buildSearchTerm in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the key of the K/V propertyvalue - the value object of the K/V propertydtValue - the data type of the value object
public org.apache.lucene.index.Term buildSearchTermObject(java.lang.String key,
java.lang.Object value,
java.lang.Class dtValue)
key - the key of the K/V propertyvalue - the value object of the K/V propertydtValue - the data type of the value objectTerm object.public void clearIndex()
clearIndex in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public void close()
close in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public void commit()
commit in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>
public final long count(java.lang.String key,
java.lang.Object value)
count in interface com.tinkerpop.blueprints.Index<T extends com.tinkerpop.blueprints.Element>key - the name of the property. It MUST not be NULL. If the key is not found in the index, the result will be 0.value - the value object of the property. It can be NULL which will cause all elements with the given key to be returned.CloseableIterable object.
public final long count(java.lang.String key,
java.lang.Object value,
boolean acceptWildcard)
count in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the name of the property. It MUST not be NULL. If the key is not found in the index, the result will be 0.value - the value object of the property. It can be NULL which will cause all elements with the given key to be returned.acceptWildcard - specifies if wild cards can be used in the value object. the indexCloseableIterable object.
public long count(java.lang.String key,
java.lang.Object value,
java.lang.Class dtValue,
boolean acceptWildcard)
count in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the name of the property. It MUST not be NULL. If the key is not found in the index, the result will be 0.value - the value object of the property. It can be NULL which will cause all elements with the given key to be returned.dtValue - the class representing the datatype of the property value. This can be used to cast the property value to a different datatype. For example, if the value is "3.01" and dtValue is Float.Class, then this value will be treated as a 3.01f.acceptWildcard - specifies if wild cards can be used in the value object. the indexCloseableIterable object.public void dropIndex()
dropIndex in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public abstract com.tinkerpop.blueprints.CloseableIterable<T> get(java.lang.Object query)
get in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>query - a object representing the text query to execute.CloseableIterable object.public final com.tinkerpop.blueprints.CloseableIterable<T> get(java.lang.String key, java.lang.Object value)
get in interface com.tinkerpop.blueprints.Index<T extends com.tinkerpop.blueprints.Element>key - the name of the property. It MUST not be NULL. If the key is not found in the index, the result will be 0.value - the value object of the property. It can be NULL which will cause all elements with the given key to be returned.CloseableIterable object.public final com.tinkerpop.blueprints.CloseableIterable<T> get(java.lang.String key, java.lang.Object value, boolean acceptWildcard)
get in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the name of the property. It MUST not be NULL. If the key is not found in the index, the result will be 0.value - the value object of the property. It can be NULL which will cause all elements with the given key to be returned.acceptWildcard - specifies if wild cards can be used in the value object. the indexCloseableIterable object.public abstract com.tinkerpop.blueprints.CloseableIterable<T> get(java.lang.String key, java.lang.Object value, java.lang.Class dtValue, boolean acceptWildcard)
get in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the name of the property. It MUST not be NULL. If the key is not found in the index, the result will be 0.value - the value object of the property. It can be NULL which will cause all elements with the given key to be returned.dtValue - the class representing the datatype of the property value. This can be used to cast the property value to a different datatype. For example, if the value is "3.01" and dtValue is Float.Class, then this value will be treated as a 3.01f.acceptWildcard - specifies if wild cards can be used in the value object. the indexCloseableIterable object.public org.apache.lucene.store.Directory getDirectory(int index)
Directory object for the specified subdirectory ID.index - the subdirectory ID. The directories in the Lucene index are a positive number from the range of [0 to N - 1] where N is the total number of subdirectories.public final java.lang.String getDirectoryName()
getDirectoryName in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public java.lang.String getDocIdentifier()
getDocIdentifier in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public final java.lang.String getGraphName()
getGraphName in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public final java.lang.Class<T> getIndexClass()
OracleIndexgetIndexClass in interface com.tinkerpop.blueprints.Index<T extends com.tinkerpop.blueprints.Element>getIndexClass in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public final java.lang.String getIndexName()
getIndexName in interface com.tinkerpop.blueprints.Index<T extends com.tinkerpop.blueprints.Element>public LuceneParameters getIndexParameters()
LuceneParameters object.public OracleDirectory getOracleDirectory()
OracleDirectory object.public OracleIndexParameters getOracleIndexParameters()
OracleIndexgetOracleIndexParameters in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>
public org.apache.lucene.search.SearcherManager getOracleSearcherManager(int index)
throws java.io.IOException
index - the subdirectory ID. The directories in the Lucene index are a positive number from the range of [0 to N - 1] where N is the total number of subdirectories.SearcherManager object.java.io.IOException
public org.apache.lucene.search.SearcherManager getOracleSearcherManager(int index,
boolean useCache)
throws java.io.IOException
index - the subdirectory ID. The directories in the Lucene index are a positive number from the range of [0 to N - 1] where N is the total number of subdirectories.SearcherManager object.java.io.IOExceptionpublic com.tinkerpop.blueprints.Parameter<java.lang.String,java.lang.Object>[] getParameters()
getParameters in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>Parameter array.public abstract com.tinkerpop.blueprints.CloseableIterable<T>[] getPartitioned(java.lang.Object[] connections, java.lang.Object query, int startShardId)
CloseableIterable objects that hold all the elements with an attribute matching the Query object. This object can be either a String text search query, or a Lucene Query object. Each edge in the CloseableIterable array uses a separate connection provided to fetch a subset of the results from a corresponding Lucene sub-directory. Note that we assign an integer ID (in the range of [0, N - 1]) to all the sub-directories in a Lucene index with N shards. The subset of shards (subdirectories) queried will consist of those shards with ID value in the range of [startShardId, startShardId - 1 + size of connections array].getPartitioned in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>connections - an array of connections to the Lucene index Each edge of this array should be of type SearcherManager. See getOracleSearcherManager(int).query - a a object representing the text query to execute.startShardId - the ID of the starting shard.CloseableIterable object.public final com.tinkerpop.blueprints.CloseableIterable<T>[] getPartitioned(java.lang.Object[] connections, java.lang.String key, java.lang.Object value, boolean acceptWildcard, int startShardId)
CloseableIterable objects that hold all the elements with an attribute matching the given K/V pair. Each element in the CloseableIterable array uses a separate connection provided to fetch a subset of the results from a corresponding Lucene sub-directory. Note that we assign an integer ID (in the range of [0, N - 1]) to all the sub-directories in a Lucene index with N shards. The subset of shards (subdirectories) queried will consist of those shards with ID value in the range of [startShardId, startShardId - 1 + size of connections array].getPartitioned in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>connections - an array of connections to the index. Each element of this array should be of type SearcherManager. See getOracleSearcherManager(int).key - the key of a propertyvalue - the value object of the property.acceptWildcard - specifies if wild cards can be used in the value object.startShardId - the ID of the starting shard.CloseableIterable object.public abstract com.tinkerpop.blueprints.CloseableIterable<T>[] getPartitioned(java.lang.Object[] connections, java.lang.String key, java.lang.Object value, java.lang.Class dtValue, boolean acceptWildcard, int startShardId)
CloseableIterable objects that hold all the elements with an attribute matching the given K/V pair. Each element in the CloseableIterable array uses a separate connection provided to fetch a subset of the results from a corresponding Lucene sub-directory. Note that we assign an integer ID (in the range of [0, N - 1]) to all the sub-directories in a Lucene index with N shards. The subset of shards (subdirectories) queried will consist of those shards with ID value in the range of [startShardId, startShardId - 1 + size of connections array].getPartitioned in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>connections - an array of connections to the Lucene index. Each element of this array should be of type SearcherManager. See getOracleSearcherManager(int).key - the key of a propertyvalue - the value object of the property.dtValue - the class representing the datatype of the property value. This can be used to cast the property value to a different datatype. For example, if the value is "3.01" and dtValue is Float.Class, then this value will be treated as a 3.01f.acceptWildcard - specifies if wild cards can be used in the value object.startShardId - the ID of the starting shard.CloseableIterable object.public org.apache.lucene.search.SearcherFactory getSearcherFactory()
public int getTotalShards()
getTotalShards in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>public boolean isAutoIndex()
public void put(java.lang.String key,
java.lang.Object value,
T element)
put in interface com.tinkerpop.blueprints.Index<T extends com.tinkerpop.blueprints.Element>key - the key to index the element by.value - the value to index the element by.element - the element to index.
public void put(java.lang.String key,
java.lang.Object value,
T element,
OracleIndexWriter[] indexWriters)
OracleIndexWriter for all the sub-directories in the text index reduce the number of open/commit/close operations to Apache Lucene. The user is responsible of calling the commit operation on each index writer so the changes executed by this operation are persisted into the text index.key - the key to index the element by.value - the value to index the element by.element - the element to index.indexWriters - if not null, the cache of indexWriters to use, this avoids opening/closing index writers at flush time, but locks writing operations over the index.public final com.tinkerpop.blueprints.CloseableIterable<T> query(java.lang.String key, java.lang.Object value)
query in interface com.tinkerpop.blueprints.Index<T extends com.tinkerpop.blueprints.Element>key - the key of the K/V propertyvalue - the value object of the K/V propertyCloseableIterable object.public final com.tinkerpop.blueprints.CloseableIterable<T> query(java.lang.String key, java.lang.Object value, boolean useWildcards)
query in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the key of the K/V propertyvalue - the value object of the K/V propertyuseWildcards - specifies if wild cards can be used in the value object.CloseableIterable object.
public void remove(java.lang.String key,
java.lang.Object value,
java.lang.Class dtValue,
T element,
OracleIndexWriter[] indexWriters)
OracleIndexWriter for all the sub-directories in the text index reduce the number of open/commit/close operations to Apache Lucene. The user is responsible of calling the commit operation on each index writer so the changes executed by this operation are persisted into the text index.key - the key of the indexed element.value - the value of the indexed element.dtValue - the data type class of the indexed element.element - the element to remove given the key/value pair.indexWriters - if not null, the cache of indexWriters to use, this avoids opening/closing index writers at flush time, but locks writing operations over the index.
public void remove(java.lang.String key,
java.lang.Object value,
T element)
remove in interface com.tinkerpop.blueprints.Index<T extends com.tinkerpop.blueprints.Element>key - the key of the indexed element.value - the value of the indexed element.element - the element to remove given the key/value pair.
public void remove(java.lang.String key,
java.lang.Object value,
T element,
OracleIndexWriter[] indexWriters)
key - the key of the indexed element.value - the value of the indexed element.element - the element to remove given the key/value pair.indexWriters - if not null, the cache of indexWriters to use, this avoids opening/closing index writers at flush time, but locks writing operations over the index.public void remove(T element)
remove in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>element - an Element object.java.io.IOExceptionpublic void removeAll(java.lang.String key)
removeAll in interface OracleIndex<T extends com.tinkerpop.blueprints.Element>key - the key to remove from the index.
public void removeAll(java.lang.String key,
OracleIndexWriter[] indexWriters)
OracleIndexWriter for all the sub-directories in the text index reduce the number of open/commit/close operations to Apache Lucene. The user is responsible of calling the commit operation on each index writer so the changes executed by this operation are persisted into the text index.key - the key to remove from the index.indexWriters - if not null, the cache of indexWriters to use, this avoids opening/closing index writers at flush time, but locks writing operations over the index.Copyright © 2017, 2018 Oracle and/or its affiliates. All Rights Reserved.