org.neo4j.index.impl.lucene
Class LuceneIndex<T extends PropertyContainer>
java.lang.Object
org.neo4j.index.impl.lucene.LuceneIndex<T>
- All Implemented Interfaces:
- Index<T>, ReadableIndex<T>
public abstract class LuceneIndex<T extends PropertyContainer>
- extends Object
- implements Index<T>
Method Summary |
void |
add(T entity,
String key,
Object value)
See Index.add(PropertyContainer, String, Object) for more generic
documentation. |
void |
delete()
|
IndexHits<T> |
get(String key,
Object value)
|
protected abstract T |
getById(long id)
|
Integer |
getCacheCapacity(String key)
|
protected abstract long |
getEntityId(T entity)
|
GraphDatabaseService |
getGraphDatabase()
|
String |
getName()
|
boolean |
isWriteable()
|
protected abstract org.neo4j.index.impl.lucene.LuceneCommand |
newAddCommand(PropertyContainer entity,
String key,
Object value)
|
protected abstract org.neo4j.index.impl.lucene.LuceneCommand |
newRemoveCommand(PropertyContainer entity,
String key,
Object value)
|
T |
putIfAbsent(T entity,
String key,
Object value)
|
IndexHits<T> |
query(Object queryOrQueryObject)
|
protected IndexHits<T> |
query(org.apache.lucene.search.Query query,
String keyForDirectLookup,
Object valueForDirectLookup,
QueryContext additionalParametersOrNull)
|
IndexHits<T> |
query(String key,
Object queryOrQueryObject)
queryOrQueryObject can be a String containing the query
in Lucene syntax format, http://lucene.apache.org/java/3_0_2/queryparsersyntax.html. |
void |
remove(T entity)
|
void |
remove(T entity,
String key)
|
void |
remove(T entity,
String key,
Object value)
See Index.remove(PropertyContainer, String, Object) for more
generic documentation. |
void |
setCacheCapacity(String key,
int capacity)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getGraphDatabase
public GraphDatabaseService getGraphDatabase()
- Specified by:
getGraphDatabase
in interface ReadableIndex<T extends PropertyContainer>
getName
public String getName()
- Specified by:
getName
in interface ReadableIndex<T extends PropertyContainer>
add
public void add(T entity,
String key,
Object value)
- See
Index.add(PropertyContainer, String, Object)
for more generic
documentation.
Adds key/value to the entity
in this index. Added values are
searchable within the transaction, but composite AND
queries aren't guaranteed to return added values correctly within that
transaction. When the transaction has been committed all such queries
are guaranteed to return correct results.
- Specified by:
add
in interface Index<T extends PropertyContainer>
- Parameters:
entity
- the entity (i.e Node
or Relationship
)
to associate the key/value pair with.key
- the key in the key/value pair to associate with the entity.value
- the value in the key/value pair to associate with the
entity.
putIfAbsent
public T putIfAbsent(T entity,
String key,
Object value)
- Specified by:
putIfAbsent
in interface Index<T extends PropertyContainer>
remove
public void remove(T entity,
String key,
Object value)
- See
Index.remove(PropertyContainer, String, Object)
for more
generic documentation.
Removes key/value to the entity
in this index. Removed values
are excluded within the transaction, but composite AND
queries aren't guaranteed to exclude removed values correctly within
that transaction. When the transaction has been committed all such
queries are guaranteed to return correct results.
- Specified by:
remove
in interface Index<T extends PropertyContainer>
- Parameters:
entity
- the entity (i.e Node
or Relationship
)
to dissociate the key/value pair from.key
- the key in the key/value pair to dissociate from the entity.value
- the value in the key/value pair to dissociate from the
entity.
remove
public void remove(T entity,
String key)
- Specified by:
remove
in interface Index<T extends PropertyContainer>
remove
public void remove(T entity)
- Specified by:
remove
in interface Index<T extends PropertyContainer>
delete
public void delete()
- Specified by:
delete
in interface Index<T extends PropertyContainer>
get
public IndexHits<T> get(String key,
Object value)
- Specified by:
get
in interface ReadableIndex<T extends PropertyContainer>
query
public IndexHits<T> query(String key,
Object queryOrQueryObject)
-
queryOrQueryObject
can be a String
containing the query
in Lucene syntax format, http://lucene.apache.org/java/3_0_2/queryparsersyntax.html.
Or it can be a Query
object. If can even be a QueryContext
object which can contain a query (String
or Query
) and
additional parameters, such as Sort
.
Because of performance issues, including uncommitted transaction modifications
in the result is disabled by default, but can be enabled using
QueryContext.tradeCorrectnessForSpeed()
.
- Specified by:
query
in interface ReadableIndex<T extends PropertyContainer>
query
public IndexHits<T> query(Object queryOrQueryObject)
-
- Specified by:
query
in interface ReadableIndex<T extends PropertyContainer>
- See Also:
query(String, Object)
query
protected IndexHits<T> query(org.apache.lucene.search.Query query,
String keyForDirectLookup,
Object valueForDirectLookup,
QueryContext additionalParametersOrNull)
isWriteable
public boolean isWriteable()
- Specified by:
isWriteable
in interface ReadableIndex<T extends PropertyContainer>
setCacheCapacity
public void setCacheCapacity(String key,
int capacity)
getCacheCapacity
public Integer getCacheCapacity(String key)
getById
protected abstract T getById(long id)
getEntityId
protected abstract long getEntityId(T entity)
newAddCommand
protected abstract org.neo4j.index.impl.lucene.LuceneCommand newAddCommand(PropertyContainer entity,
String key,
Object value)
newRemoveCommand
protected abstract org.neo4j.index.impl.lucene.LuceneCommand newRemoveCommand(PropertyContainer entity,
String key,
Object value)
Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.