Returns an array of Strings which are the names of the fields for the source table of the record.
Namespace: NetricsServerInterface
Assembly: NetricsServerInterface (in NetricsServerInterface.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function getFieldNames() As String() _ Implements INetricsMappedRecord.getFieldNames |
C# |
---|
public string[] getFieldNames() |
C++ |
---|
public: array<String>^ getFieldNames() sealed |
J# |
---|
public string[] getFieldNames() |
JScript |
---|
public function getFieldNames() : String[] |
Return Value
The names of the table's fields
Implements
INetricsMappedRecord.getFieldNames
Example
This sample shows how to perform a search of a TIBCO Patterns Engine table using a Simple query retrieving both the field data and field names for each record in the response.
![]() | |
---|---|
// In this example a Simple search will be configured. The sample demonstrates searching // the names table for the query string "brown dennis". The fields to matched against this // string are "last" and "first". The weight for "last" is 1.0 and for "first" is .5. In this // case the "last" name will have a higher importance in the score so that records with a "last" // match will have a higher similarity score than those of "first" and will appear higher in the // result set in the response. using NetricsServerInterface; class MyClass { private static NetricsServerInterface.NetricsServerInterface si = null; public static void Main() { try { String host = "localhost"; int port = 5051; si = new NetricsServerInterface.NetricsServerInterface(host, port); // Query will contain the query string or tokens to be matched against String query = "brown dennis"; // Table is the TIBCO Patterns Engine table to be search/matched against query String table = "names"; // FieldNames contain the fields within the table to be searhed/matched against. // If fieldNames is set to null then all fields will be searched/matched against String[] fieldNames = {"last" , "first"}; // FieldWeights is an array that must be the same length as fields and contain the // weights (0.0 - 1.0) of each field that contribute to the overall score of the result double[] fieldWeights = { 1.0, .5 }; // Create NetricsSearchOpts object using the defaults NetricsSearchOpts opts = new NetricsSearchOpts(); // Create the NetricsSearchCfg pointing to the table to be searched/matched against NetricsSearchCfg tblCfg = new NetricsSearchCfg(table); // Add a Simple query to the NetricsSearchCfg using the query, fieldNames and fieldWeights tblCfg.setNetricsQuery(NetricsQuery.Simple(query, fieldNames, fieldWeights)); // Perform the search/match using the NetricsSearchCfg and NetricsSearchOpts NetricsSearchResponse resp = si.search(tblCfg, opts); String s = ""; // Get the results of the search/match NetricsSearchResult[] res = resp.getSearchResults(); // Create viables for result processing String[] xfieldNames; String[] xfields; // Iterate through the result records for (int i = 0; i < res.Length; i++) { // Get the fieldNames in the result record xfieldNames = res[i].getFieldNames(); // Get the data for each fieldName in result record xfields = res[i].getFields(); // Get the score for this result record double score = res[i].getMatchScore(); // Build the printline for the result record s = s + "Rank=" + i + ", Score=" + score.ToString(); for (int x = 0; x < xfields.Length; x++) { s = s + ", " + xfieldNames[x] + "=" + xfields[x]; } s = s + "\n"; } Console.WriteLine(s); } catch (NetricsException e) { Console.Write(e.getErrorDescription() + "\n"); } } } |