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:
//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.
//Create a query from the browser request query string ENEQuery nequery = new UrlENEQuery(Request.QueryString.ToString(), “UTF-8”);
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.
//Create an empty ENEQuery object and populate it using setter methods ENEQuery nequery = new ENEQuery(); nequery.setNavDescriptors(dimensionValueIDs); nequery.setERec(recordID); ...
//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-Endeca 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:
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);
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;