The
collection()
function is used to query the MDEX Engine
for a set (that is, a collection) of Oracle Commerce records, based on an
expression that defines the records you want.
EQL
enables you to make the following types of requests, all of which begin with
the
collection()
function:
The basic syntax for the
collection()
function is:
fn:collection()/record[expression]
The
fn:
prefix is optional, and for the sake of brevity will
not be used in the examples in this chapter. The
/record
step indicates that Oracle Commerce records are
being selected. The
expression
argument (which is called the predicate) is
an EQL expression that filters the total record set to the subset that you
want. The predicate can contain one or more
collection()
functions (multiple functions are
nested).
Issuing the
collection()
function without a predicate (that is,
without an expression) returns the total record set because the query is not
filtering the records. This query is therefore the same as issuing only an
N=0
navigation query, which is a root navigation
request.
The following sample query illustrates the use of the
collection()
function with the
Nrs
parameter:
controller.jsp?N=0&Nrs=collection()/record[book_id = 8492]
Because EQL is a filtering language, it does not have a built-in
sorting option. Therefore, an EQL request returns the record set using the MDEX
Engine default sort order. You can, however, append a URL sorting parameter,
such as the
Ns
parameter. For more information about the interaction
with other Oracle Commerce features, see “Oracle Commerce Query Language and
other features.”