This topic contains examples of code in Java and .NET for
obtaining Boolean search information in an
ESearchReport
object.
There are no object types or method calls associated with MatchBoolean search query processing. Results are returned the same as for default MatchAll search queries.
However, results returned by the MDEX Engine for MatchBoolean URL query
parameters contain the following information in the Record Search Report
supplement (ESearchReport
object):
Whether or not the Boolean query is valid. Use the
ESearchReport.isValid()
method to determine this.If the query is invalid, an error message is returned. Use
ESearchReport.getErrorMessage()
(Java), andESearchReport.ErrorMessage
(.NET) to obtain an error message (in English) that is suitable for display directly to the user.
Example 75. Java example
The following code sample in Java shows how to obtain the information
in the
ESearchReport
object:
// Get the Map of ESearchReport objects Map recSrchRpts = nav.getESearchReportsComplete(); if (recSrchRpts.size() > 0) { // Get the user's search key String searchKey = request.getParameter("Ntk"); if (searchKey != null) { if (recSrchRpts.containsKey(searchKey)) { // Get the List of ERecSearchReports for the search key List srchRptList = (List)recSrchRpts.get(searchKey); for (Iterator i = srchRptList.iterator(); i.hasNext()) { ESearchReport srchRpt = ESearchReport(i.next()); // Check if the search is valid if (! srchRpt.isValid()) { // If invalid search, get the error message String errorMessage = srchRpt.getErrorMessage(); // Print or log the message ... } } } } }
Example 76. .NET Example
The following code sample in .NET shows how to obtain the information
in the
ESearchReport
object:
// Get the Dictionary of ESearchReport objects IDictionary recSrchRpts = nav.ESearchReportsComplete; // Get the user's search key String searchKey = Request.QueryString["Ntk"]; if (searchKey != null) { if (recSrchRpts.Contains(searchKey)) { // Get the List of ERecSearchReports for the search key IList srchRptList = (IList)recSrchRpts[searchKey]; foreach (object ob in srchReportList) { ESearchReport srchReport = (ESearchReport)ob; // Check if the search is valid if (! srchRpt.isValid()) { // If invalid search, get the error message String errorMessage = srchRpt.ErrorMessage; // Print or log the message ... } } } }