You use the
ENEQuery class, or its subclass
UrlENEQuery, to create an MDEX Engine query.
You use the
UrlENEQuery class to parse MDEX Engine-specific
parameters from the browser request query string into MDEX Engine query
parameters.
The code to accomplish this task looks like the following:
Java:
//Create a query from the browser request query string ENEQuery nequery = new UrlENEQuery(request.getQueryString(), "UTF-8");
The browser request query string resides in the
HTTPServletRequest object from the
javax.servlet.http package.
.NET:
//Create a query from the browser request query string ENEQuery nequery = new UrlENEQuery(Request.QueryString.ToString(), "UTF-8");
Note
The browser request query string resides in the
HttpRequest object from the
System.Web namespace in ASP.NET. ASP.NET exposes
the
HttpRequest object as the intrinsic request object.
The
UrlENEQuery class ignores non-MDEX Engine-specific
parameters, so this class is still safe to use when additional
application-specific parameters are needed (as long as they don’t conflict with
the MDEX Engine URL parameter namespace).
Alternatively, you can use the
ENEQuery class to instantiate an empty
ENEQuery object, and then populate it with MDEX
Engine query parameters using a variety of
setter methods in Java, or
ENEQuery properties in .NET.
The code to accomplish this task is similar to the example below:
Java:
//Create an empty ENEQuery object and populate it using setter methods ENEQuery nequery = new ENEQuery(); nequery.setNavDescriptors(dimensionValueIDs); nequery.setERec(recordID); ...
.NET:
//Create an empty ENEQuery object and populate it using properties ENEQuery nequery = new ENEQuery(); nequery.NavDescriptors = dimensionValueIDs nequery.ERec = recordID ...
You can use the
ENEQuery class to construct a query from any source
of state information, including non-Oracle Commerce URL parameters, cookies,
server-side session objects, and so forth. These are all application design
decisions and have no impact on the final MDEX Engine query or its results.
The following are all valid ways of creating an MDEX Engine query:
Java:
ENEQuery nequery = new UrlENEQuery("N=123", "UTF-8");
ENEQuery nequery = new ENEQuery();
DimValIdList descriptors = new DimValIdList("123");
nequery.setNavDescriptors(descriptors);
ENEQuery nequery = new ENEQuery();
DimValIdList descriptors =
new DimValIdList((String)session.getAttribute("<variableName>");
nequery.setNavDescriptors(descriptors);
ENEQuery nequery = new ENEQuery();
DimValIdList descriptors = new DimValIdList(request.getParameter("N"));
nequery.setNavDescriptors(descriptors);.NET:
ENEQuery nequery = new UrlENEQuery("N=123", "UTF-8");
ENEQuery nequery = new ENEQuery();
DimValIdList descriptors = new DimValIdList("123");
nequery.NavDescriptors = descriptors;
ENEQuery nequery = new ENEQuery();
DimValIdList descriptors = new DimValIdList(Request.QueryString["N"]);
nequery.NavDescriptors = descriptors;The
ENEConnection
query() method in Java, and the
HttpENEConnection
Query() method in .NET use an
ENEQuery object as its argument when they query the MDEX
Engine.
The code to execute an MDEX Engine query looks like this:
Example 103. Java Example
//Execute the MDEX Engine query ENEQueryResults qr = eneConnectionObject.query(eneQueryObject);
Example 104. .NET Example
//Execute the Navigation Engine query ENEQueryResults qr = eneConnectionObject.Query(eneQueryObject);

