The collection() function is used to query the MDEX Engine for a set (that is, a collection) of Endeca records, based on an expression that defines the records you want.
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 Endeca 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.
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 or the Nrk, Nrt, Nrr, and Nrm set of parameters. For more information on the interaction with other Endeca features, see “Endeca Query Language and other features.”