public class IndexQueryBuilder extends BaseQuery implements TitanIndexQuery
TitanIndexQuery for string based queries that are issued directly against the specified
indexing backend. It is assumed that the given string conforms to the query language of the indexing backend.
This class does not understand or verify the provided query. However, it will introspect the query and replace
any reference to `v.SOME_KEY`, `e.SOME_KEY` or `p.SOME_KEY` with the respective key reference. This replacement
is 'dumb' in the sense that it relies on simple string replacements to accomplish this. If the key contains special characters
(in particular space) then it must be encapsulated in quotation marks.
In addition to the query string, a number of parameters can be specified which will be passed verbatim to the indexing
backend during query execution.
This class essentially just acts as a builder, uses the IndexSerializer to execute the query, and then post-processes
the result set to return to the user.TitanIndexQuery.Result<V extends org.apache.tinkerpop.gremlin.structure.Element>| Constructor and Description |
|---|
IndexQueryBuilder(StandardTitanTx tx,
IndexSerializer serializer) |
| Modifier and Type | Method and Description |
|---|---|
IndexQueryBuilder |
addParameter(Parameter para)
Adds the given parameter to the list of parameters of this query.
|
IndexQueryBuilder |
addParameters(Iterable<Parameter> paras)
Adds the given parameters to the list of parameters of this query.
|
IndexQueryBuilder |
addParameters(Parameter... paras)
Adds the given parameters to the list of parameters of this query.
|
Iterable<TitanIndexQuery.Result<TitanEdge>> |
edges()
Returns all edges that match the query in the indexing backend.
|
String |
getIndex() |
int |
getOffset() |
Parameter[] |
getParameters() |
String |
getPrefix() |
String |
getQuery() |
String |
getUnknownKeyName() |
IndexQueryBuilder |
limit(int limit)
Specifies the maxium number of elements to return
|
IndexQueryBuilder |
offset(int offset)
Specifies the offset of the query.
|
Iterable<TitanIndexQuery.Result<TitanVertexProperty>> |
properties()
Returns all properties that match the query in the indexing backend.
|
IndexQueryBuilder |
setElementIdentifier(String identifier)
Sets the element identifier string that is used by this query builder as the token to identifier key references
in the query string.
|
IndexQueryBuilder |
setIndex(String indexName) |
IndexQueryBuilder |
setQuery(String query) |
Iterable<TitanIndexQuery.Result<TitanVertex>> |
vertices()
Returns all vertices that match the query in the indexing backend.
|
public IndexQueryBuilder(StandardTitanTx tx, IndexSerializer serializer)
public String getIndex()
public Parameter[] getParameters()
public String getQuery()
public int getOffset()
public String getPrefix()
public IndexQueryBuilder setElementIdentifier(String identifier)
TitanIndexQuerysetElementIdentifier in interface TitanIndexQueryidentifier - The element identifier which must not be blankpublic String getUnknownKeyName()
public IndexQueryBuilder setIndex(String indexName)
public IndexQueryBuilder setQuery(String query)
public IndexQueryBuilder offset(int offset)
TitanIndexQueryoffset in interface TitanIndexQuerypublic IndexQueryBuilder limit(int limit)
TitanIndexQuerylimit in interface TitanIndexQuerypublic IndexQueryBuilder addParameter(Parameter para)
TitanIndexQueryaddParameter in interface TitanIndexQuerypublic IndexQueryBuilder addParameters(Iterable<Parameter> paras)
TitanIndexQueryaddParameters in interface TitanIndexQuerypublic IndexQueryBuilder addParameters(Parameter... paras)
TitanIndexQueryaddParameters in interface TitanIndexQuerypublic Iterable<TitanIndexQuery.Result<TitanVertex>> vertices()
TitanIndexQueryvertices in interface TitanIndexQuerypublic Iterable<TitanIndexQuery.Result<TitanEdge>> edges()
TitanIndexQueryedges in interface TitanIndexQuerypublic Iterable<TitanIndexQuery.Result<TitanVertexProperty>> properties()
TitanIndexQueryproperties in interface TitanIndexQueryCopyright © 2012–2015. All rights reserved.