An
ESearchReport object provides access to summary
information about the search through accessor methods (Java), and properties
(.NET). This topic contains code examples for accessing summary information in
search reports.
The report provides basic information about
the search through the following
ESearchReport
methods (Java), and properties (.NET):
|
Method (Java) or property (.NET) |
Description |
|---|---|
|
Java:
NET:
|
Returns the search key used in the current search. |
|
Java:
.NET:
|
Returns the search terms as a single String. |
|
Java:
.NET:
|
Returns the number of results that matched the search query. For record searches, this is the number of records. For dimension searches, this is the number of matching dimension values. |
Match mode information is available through the following
ESearchReport methods (Java), or properties (.NET):
|
Method (Java) or property (.NET) |
Description |
|---|---|
|
Java:
NET:
|
Returns the requested match mode. |
|
Java:
.NET:
|
Returns the selected match mode. This is different than
|
|
Java:
.NET:
|
Returns the number of search terms that were successfully matched. |
Word interpretation information, which is useful for highlighting or
informing users about query expansion, is available through the
ESearchReport.getWordInterps() method (Java), and
ESearchReport.WordInterps property (.NET). The method
and property return a
PropertyMap that associates words or phrases with
their expansions.
Spelling correction information is available through two
ESearchReport methods (Java), and properties (.NET):
|
Method (Java) or property (.NET) |
Description |
|---|---|
|
Java:
NET:
|
Is used for autosuggest (alternate spelling correction)
results and returns a
|
|
Java:
.NET:
|
Is used for "Did You Mean" results and returns a List an IList
of
|
The
ESearchAutoSuggestion, and
ESearchDYMSuggestion classes have
getTerms() method (Java), and
Terms property (.NET) that return the suggestion as a
string.
The
ESearchDYMSuggestion class also includes a
getNumMatchingResults() method (Java), and
NumMatchingResults property (.NET) that return the
number of results associated with the "Did You Mean" suggestion. For more
information about these features, see the section on the "Did You Mean" feature.
Finally, the following
ESearchReport
calls report error or warning information:
The
getTruncatedTerms()method (Java) andTruncatedTermsproperty (.NET) return the truncated query terms (as a single string), if the query was truncated. If the number of search terms is too large, the MDEX Engine truncates the query for performance reasons. This method or property return the new set of search terms after the truncation.The
isValid()method (Java and .NET) returnstrueif the search query is valid.If
falseis returned, usegetErrorMessage()(Java), andErrorMessage(.NET) to get the error message.The
getErrorMessage()method (Java), andErrorMessageproperty (.NET) return the error message for an invalid query.
Example 72. Java example
The following code snippet in Java shows how to access information in
an
ESearchReport object:
// Get the Map of Lists ESearchReport objects
Map recSrchRpts = nav.getESearchReportsComplete();
// Declare the search key being sought
String desiredKey = "my_search_interface";
if (recSrchRpts.containsKey(desiredKey)) {
// Get the list of ERecSearchReports for the desired search key
List srchReportList = (List)recSrchRpts.get(desiredKey);
for (Iterator i = srchReportList.iterator(); i.hasNext()) {
ESearchReport srchReport = (ESearchReport)i.next();
// Get the search term submitted for this search report
String srchTerms = srchReport.getTerms();
// Get the number of matching results
long numMatchingResults = srchReport.getNumMatchingResults();
// Get the match mode that was used for this search
ESearchReport.Mode mode = srchReport.getMatchedMode();
// Display a message if MatchAll mode was used
// by the MDEX Engine
String matchallMsg = "";
if (mode == ESearchReport.MODE_ALL) {
matchallMsg = "MatchAll mode was used";
}
// Print or log the message
...
}
}
Example 73. .NET Example
The following code snippet in .NET shows how to access information in
an
ESearchReport object:
// Get the Dictionary of ESearchReport objects
IDictionary recSrchRpts = nav.ESearchReports;
// Declare the search key being sought
String desiredKey = "my_search_interface";
if (recSrchRpts.Contains(desiredKey)) {
// Get the ERecSearchReport for the desired search key
IList srchReportList = (IList)recSrchRpts[desiredKey];
foreach (object ob in srchReportList) {
ESearchReport srchReport = (ESearchReport)ob;
// Get the search term submitted for this search report
String srchTerms = srchReport.Terms;
// Get the number of matching results
long numMatchingResults = srchReport.NumMatchingResults;
// Get the match mode that was used for this search
ESearchReport.Mode mode = srchReport.MatchedMode;
// Display a message if MatchAll mode was used by
// Navigation Engine
String matchallMessage = "";
if (mode == ESearchReport.MODE_ALL) {
matchallMessage = "MatchAll mode was used";
}
// Print or log the message
...
}
}

