GQL
instead.public final class GQL
extends java.lang.Object
GQL
is a simple fulltext query language, which supports field
prefixes similar to Lucene or Google queries.
title:jackrabbit
. When a property
prefix is omitted, GQL will perform a fulltext search on all indexed
properties of a node. There are a number of pseudo properties that have
special meaning:
path:
only search nodes below this path. If you
specify more than one term with a path prefix, only the last one will be
considered.type:
only return nodes of the given node types. This
includes primary as well as mixin types. You may specify multiple comma
separated node types. GQL will return nodes that are of any of the specified
types.order:
order the result by the given properties. You
may specify multiple comma separated property names. To order the result in
descending order simply prefix the property name with a minus. E.g.:
order:-name
. Using a plus sign will return the result in
ascending order, which is also the default.limit:
limits the number of results using an
interval. E.g.: limit:10..20
Please note that the interval is
zero based, start is inclusive and end is exclusive. You may also specify an
open interval: limit:10..
or limit:..20
If the dots
are omitted and only one value is specified GQL will return at most this
number of results. E.g. limit:10
(will return the first 10
results)"jcr:content/jcr:mimeType":text/plain
title:"apache jackrabbit"
. Similarly you need to enclose the
property name if it contains a colon: "jcr:title":apache
,
otherwise the first colon is interpreted as the separator between the
property name and the value. This also means that a value that contains
a colon does not need to be enclosed in double quotes.
type:file
' and GQL will return nodes that are
of node type nt:file
. Similarly you can write:
order:lastModified
and your result nodes will be sorted by their
jcr:lastModified
property value.
execute(String, Session, String)
. E.g. if
you are searching for file nodes with matches in their resource node. The
common path prefix is prepended to every term (except to pseudo properties)
before the query is executed. This means you can write:
'type:file jackrabbit
' and call execute with three parameters,
where the third parameter is jcr:content
. GQL will return
nt:file
nodes with jcr:content
nodes that contain
matches for jackrabbit
.
Row.getValue("rep:excerpt()");
. Please note
that this is feature is Jackrabbit specific and will not work with other
implementations!Modifier and Type | Class and Description |
---|---|
static interface |
GQL.Filter
Deprecated.
use
GQL.Filter
instead. |
static interface |
GQL.ParserCallback
Deprecated.
use
GQL.ParserCallback
instead. |
Constructor and Description |
---|
GQL()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static RowIterator |
execute(java.lang.String statement,
Session session)
Deprecated.
Executes the GQL query and returns the result as a row iterator.
|
static RowIterator |
execute(java.lang.String statement,
Session session,
java.lang.String commonPathPrefix)
Deprecated.
Executes the GQL query and returns the result as a row iterator.
|
static RowIterator |
execute(java.lang.String statement,
Session session,
java.lang.String commonPathPrefix,
GQL.Filter filter)
Deprecated.
Executes the GQL query and returns the result as a row iterator.
|
static void |
parse(java.lang.String statement,
Session session,
GQL.ParserCallback callback)
Deprecated.
Parses the given
statement and generates callbacks for each
GQL term parsed. |
public static RowIterator execute(java.lang.String statement, Session session)
statement
- the GQL query.session
- the session that will execute the query.public static RowIterator execute(java.lang.String statement, Session session, java.lang.String commonPathPrefix)
statement
- the GQL query.session
- the session that will execute the query.commonPathPrefix
- a common path prefix for the GQL query.public static RowIterator execute(java.lang.String statement, Session session, java.lang.String commonPathPrefix, GQL.Filter filter)
statement
- the GQL query.session
- the session that will execute the query.commonPathPrefix
- a common path prefix for the GQL query.filter
- an optional filter that may include/exclude result rows.public static void parse(java.lang.String statement, Session session, GQL.ParserCallback callback) throws RepositoryException
statement
and generates callbacks for each
GQL term parsed.statement
- the GQL statement.session
- the current session to resolve namespace prefixes.callback
- the callback handler.RepositoryException
- if an error occurs while parsing."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"