A typical Guided Search application displays a list of Endeca records in the user's current navigation state.
The navigation state initially matches the user’s search query. The user can subsequently click named links to subsets of the list of records in the current navigation state. The subsets are known as refinements.
For example, a search for "35mm film" might return, in addition to a list of brands of 35mm film, a list of refinements such as "color" and "black and white". By clicking the refinement "color", the user refines the navigation state and limits the list of film brands to color films. The user might then click the refinements "print film" or "slide film" to limit the list of film brands to color films for either prints or slides.
The record list can be displayed as a table, with each row corresponding to a specific record. Each row displays some identifying information about that specific record, such as a name, title, or identification number.
A list of records is returned by every query to the MDEX Engine. Your application can iterate through this list, extract the identifying information for each record, and display a table that contains the results.
An MDEX Engine
query returns a list of records in an
ERecList (Oracle Commerce records) or
AggrERecList (aggregated Oracle Commerce records)
object.
The lists of records are returned in a
Navigation object. To retrieve lists from a
Navigation object, use these methods:
Note that because the Java versions of
ERecList and
AggrERecList inherit from
java.util.AbstractList, all the iterator and indexing
methods are available for these objects.
The following code samples show how to obtain a record list, iterate
through the list, and print out each record’s
Name property.
The number of records that are returned is controlled by:
The default number of returned records is 10. These calls must be
made before the
query() method.
For aggregated Oracle Commerce records, use:
The subset of records that are returned is determined by the
combination of the offset specified in the
setNavERecsOffset() method (Java) or the
NavERecsOffset property (.NET) and the number of
records specified in the
setNavNumERecs() method (Java) or
NavNumERecs property (.NET). For example, if the
offset is set to 50 and the
setNavNumERecs() method is called with an argument
of 35, the MDEX Engine will return records 50 through 85.
Example 1. Java example
// Make MDEX Engine request. usq contains user query
// string and nec is an ENEConnection object.
ENEQueryResults qr = nec.query(usq);
// Get navigation object result
Navigation nav = qr.getNavigation();
// Get record list
ERecList records = nav.getERecs();
// Loop through record list
ListIterator i = records.listIterator();
while (i.hasNext()) {
ERec record = (ERec)i.next();
PropertyMap recordProperties = record.getProperties();
String propName = "";
// If property has a value
if (!((String)recordProperties.get("Name")).equals("")) {
propName = (String)recordProperties.get("Name");
out.print(propName);
}
}
Example 2. .NET example
// Make Navigation Engine request
ENEQueryResults qr = nec.Query(usq);
// Get Navigation object result
Navigation nav = qr.Navigation;
// Get records
ERecList recs = nav.ERecs;
// Loop over record list
for (int i=0; i<recs.Count; i++) {
// Get individual record
ERec rec = (ERec)recs[i];
// Get property map for representative record
PropertyMap propsMap = rec.Properties;
// Get and print Name property
String propName = "";
if (((String)propmap["Name"]) != "") {
propName = (String)propmap["Name"];
Response.Write propName;
}
}
The number of records that the MDEX Engine returns will affect performance.
To reduce the number of records returned by the MDEX engine – and thus, to reduce the amount of time that the MDEX engine requires to process requests – write your requests to return only the subset of records that you are interested in displaying to the user.
To do this, use the
setNavNumERecs() method (Java) or the
NavNumERecs property (.NET) and the offset specified
in the
setNavERecsOffset() method (Java) or the
NavERecsOffset property (.NET).

