| ibi Patterns .NET API

Loading...
Searching...
No Matches
Public Member Functions | List of all members
NetricsServerInterface.NetricsMappedRecord Class Reference

A NetricsMappedRecord inherits from a NetricsRecord, and has additional functionality which allows the user to access the fields of the record by field name or number. More...

## Public Member Functions
int[] | getFieldTypes ()
| Returns an array of integers which are the types of the fields for the source table of the record.
String[] | getFieldNames ()
| Returns an array of Strings which are the names of the fields for the source table of the record.
String | getField (String fieldName)
| Returns the contents of a field in the record.
String | getField (int fieldNo)
| Returns the contents of a field in the record.
String[] | getAttrNames (String field_name)
| Return a list of attribute names for a field.
String | getAttribute (String field_name, String attr_name)
| Return an attribute value for a particular field and attribute.
Public Member Functions inherited from NetricsServerInterface.NetricsRecord
| NetricsRecord (String key, String parent_key, String[] fields)
| Create a NetricsRecord object.
| NetricsRecord (String key, String parent_key, String[] fields, String[] attr_names, String[] attr_values)
| Create a NetricsRecord object.
| NetricsRecord (String key, String[] fields, String[] attr_names, String[] attr_values)
| Create a NetricsRecord object.
| NetricsRecord (String key, String[] fields)
| Create a NetricsRecord object.
Public Member Functions inherited from NetricsServerInterface.NetricsBaseRecord
String | getKey ()
| Get the key of a record.
String | getParentKey ()
| Retrieve the parent key of a record.
int | numBytes ()
| Return the number of bytes of data in this record.
String[] | getFields ()
| Can be used to get the content of a record.
String[] | getAttrNames ()
| Returns the names of name/value attributes of the record.
String[] | getAttrValues ()
| Returns the values of name/value attributes of the record.
String | getAttribute (String attr_name)
| Gets the specified attribute value of the record.
override String | ToString ()

## Additional Inherited Members
Public Types inherited from NetricsServerInterface.NetricsRecord
enum | ChildType { ORPHANS , NONORPHANS , ALL }
| The different types of child records. More...

## Detailed Description

A NetricsMappedRecord inherits from a NetricsRecord, and has additional functionality which allows the user to access the fields of the record by field name or number.

See also
  NetricsServerInterface.recget(string,string)

## Member Function Documentation

## ◆ getAttribute()

String NetricsServerInterface.NetricsMappedRecord.getAttribute | ( | String | field_name,
|  | String | attr_name
| ) |  |
| inline

Return an attribute value for a particular field and attribute.

This returns the value of a named attribute for a named field. If there is no such named field an exception is thrown. If the field can't be parsed as a Variable Attributes set or the set does not contain an attribute with the given name null is returned.

Parameters

  field_name | The name of the field.
  attr_name | The name of the attribute.

Returns
  The attribute value, null if this is not a Variable Attributes field or it contains no such attribute.

Exceptions

  NetricsException | thrown if no field with the given name exists.

## ◆ getAttrNames()

String[] NetricsServerInterface.NetricsMappedRecord.getAttrNames | ( | String | field_name | ) |
| inline

Return a list of attribute names for a field.

This returns a list of the names of all of the attributes in a particular named field. If the field can't be parsed as a Variable Attributes set null is returned. If there is no such named field an exception is thrown.

Parameters

  field_name | The name of the field.

Returns
  An array of attribute names in the original order, null if this is not a Variable Attributes field.

Exceptions

  NetricsException | thrown if no field with the given name exists.

## ◆ getField() [1/2]

String NetricsServerInterface.NetricsMappedRecord.getField | ( | int | fieldNo | ) |
| inline

Returns the contents of a field in the record.

Parameters

  fieldNo | The number of the field for which to return its data

Returns
  The contents of the field

## ◆ getField() [2/2]

String NetricsServerInterface.NetricsMappedRecord.getField | ( | String | fieldName | ) |
| inline

Returns the contents of a field in the record.

Parameters

  fieldName | The name of the field for which to return its data

Returns
  The contents of the field

## ◆ getFieldNames()

String[] NetricsServerInterface.NetricsMappedRecord.getFieldNames | ( |  | ) |
| inline

Returns an array of Strings which are the names of the fields for the source table of the record.

This sample shows how to perform a search of an ibi™ Patterns - Search 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; <br>
class MyClass
{
private static NetricsServerInterface.NetricsServerInterface si = null; <br>
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 <i>ibi Patterns - Search</i> 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");
}
}
}
NetricsServerInterface.NetricsBaseRecord.getFields
String[] getFields()
Can be used to get the content of a record.
Definition: NetricsBaseRecord.cs:349
NetricsServerInterface.NetricsException
A NetricsException is thrown whenever an error occurs.
Definition: NetricsException.cs:32
NetricsServerInterface.NetricsException.getErrorDescription
String getErrorDescription()
Get the description of the error.
Definition: NetricsException.cs:110
NetricsServerInterface.NetricsMappedRecord.getFieldNames
String[] getFieldNames()
Returns an array of Strings which are the names of the fields for the source table of the record.
Definition: NetricsMappedRecord.cs:120
NetricsServerInterface.NetricsQuery
NetricsQuery objects are used to implement the complex query structures introduced with release 4....
Definition: NetricsQuery.cs:66
NetricsServerInterface.NetricsQuery.Simple
static NetricsQuery Simple(String qstr, String[] fldnames, double[] fldweights)
Create a Simple Query Expression Node.
Definition: NetricsQuery.cs:397
NetricsServerInterface.NetricsSearchCfg
This class is used with the search methods of the NetricsServerInterface class to configure a query.
Definition: NetricsSearchCfg.cs:23
NetricsServerInterface.NetricsSearchCfg.setNetricsQuery
void setNetricsQuery(NetricsQuery nq)
Set the NetricsQuery to be performed.
Definition: NetricsSearchCfg.cs:170
NetricsServerInterface.NetricsSearchOpts
This class is used to configure search options which apply for the overall search (for all tables bei...
Definition: NetricsSearchOpts.cs:17
NetricsServerInterface.NetricsSearchResponse
This class represents the ibi™ Patterns - Search Server's response to a search command.
Definition: NetricsSearchResponse.cs:23
NetricsServerInterface.NetricsSearchResponse.getSearchResults
NetricsSearchResult[] getSearchResults()
Get the records returned by the search.
Definition: NetricsSearchResponse.cs:194
NetricsServerInterface.NetricsSearchResult
This class extends NetricsMappedRecord adding information relevant to a search result (match score,...
Definition: NetricsSearchResult.cs:24
NetricsServerInterface.NetricsSearchResult.getMatchScore
double getMatchScore()
Get the overall match score for this record.
Definition: NetricsSearchResult.cs:236
NetricsServerInterface.NetricsServerInterface
Base class for all interactions with the ibi™ Patterns - Search Server.
Definition: NetricsServerInterface.cs:62
NetricsServerInterface
ibi™ Patterns - Search .NET Interface Overview.
Definition: BaseObjectStats.cs:14

Returns
  The names of the table's fields

## ◆ getFieldTypes()

int[] NetricsServerInterface.NetricsMappedRecord.getFieldTypes | ( |  | ) |
| inline

Returns an array of integers which are the types of the fields for the source table of the record.

Returns
  The names of the table's fields