Making a secure MDEX Engine query

The Presentation API AuthHttpENEConnection class methods are used to for secure queries to the MDEX Engine.

The Endeca MDEX Engine Basic Development Guide describes how to create an MDEX Engine query by using the ENEQuery class and its UrlENEQuery subclass. It also describes how to execute the query with the Java ENEConnection.query() method (ENEConnection.Query() for .NET).

When you create an MDEX Engine query, you still use the ENEQuery or UrlENEQuery class methods. However, you use the Java AuthHttpENEConnection.query() method to make the query to the MDEX Engine (the .NET version is the Query() method).

What makes the query secure is the presence of the user entitlement filter, which limits the query results to records that the user is authorized to view.

The following examples show how to make the query to the MDEX Engine (the examples assume that the user has been successfully authenticated). Note that if you use an SSL connection between the Endeca components, the URL query parameter string will be encrypted as it is passed between the Presentation API and the MDEX Engine.

Java example

//Create a query from the browser request query string
ENEQuery usq = new UrlENEQuery(request.getQueryString(),"UTF-8");

// Set query so that only explicitly requested refinements 
// are returned
usq.setNavAllRefinements(false);

// Make the query request to the MDEX Engine over 
// the SSL connection
ENEQueryResults qresults = nec.query(usq);

//Use additional calls to process the query results
...

.NET example

//Create a query from the browser request query string
String queryString = Request.Url.Query.Substring(1);
ENEQuery usq = new UrlENEQuery(queryString, "UTF-8");

// Set query so only explicitly requested refinements are returned
usq.NavAllRefinements = false;

//Make the query request to the MDEX Engine
ENEQueryResults qresults = nec.Query(usq);

//Use additional calls to process the query results
...