| ibi Patterns .NET API

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

This class is used to configure search options which apply for the overall search (for all tables being searched). More...

## Public Types
enum | score_types { SCORE_NORMAL = 0 , SCORE_SYMMETRIC = 1 , SCORE_REVERSE = 2 , SCORE_MIN = 3 , SCORE_MAX = 4 , SCORE_IT = 5 }
| An enumeration of all possible score types. More...
enum | tiebreak_types { TIEBREAK_RECLEN =1 , TIEBREAK_RECID , TIEBREAK_ALIGNMENT , TIEBREAK_SCORETYPE , TIEBREAK_FIELDVAL }
| An enumeration of all possible tiebreak types. More...

## Public Member Functions
| NetricsSearchOpts ()
| Constructs empty opts object.
void | setGpuEnabled (Boolean? enabled)
| Set whether the search uses GPU-enabled indexing.
void | setGpuCallParallelism (int? count)
| Set the number of simultaneous GPU calls used in the search.
void | setGpuTableBlocksPerCall (int? count)
| Set the number of table-blocks evaluated per GPU call.
void | allowEmptyQueries (bool allow)
| Sets whether queries with no searchable text throw an exception or return an empty result set. The default is to throw an exception. The text of a query is all of the query strings in all Simple, Cognate, and Variable-attribute queries. A query has no searchable text when all of these strings, after applying the appropriate character-maps, contain only white-space.
bool | emptyQueriesAllowed ()
void | setSortLookupFields (String[] fields)
| Set the fields used to lookup a record in the sort filter.
void | setPsiLookupFields (String[] fields)
| Set the fields used to lookup a record in the sort filter.
void | setPsiDensity (NetricsTable.PsiDensity density)
| Set the density of suffixes produced from query field values. It is recommended that you contact your ibi representative for advice before using this option.
void | setRlModelName (String name)
| This method specifies the rlink model name to use for this search.
void | setRlPreds (NetricsPredicate[] preds)
| Set the predicates used as features by the ibi™ Patterns - Search Learn Model.
void | setDetailedStats (bool enabled)
| Enable detailed statistics for this search.
void | setGipFiltered (bool enabled)
void | setSortFiltered (bool enabled)
void | setPsiFiltered (bool enabled)
void | setPhonetic (bool enabled)
| Enable phonetic searches for this table.
void | setVisStyle (int styleNo)
| Sets the visualization style you want returned.
void | setMatchesRequested (int matchesRequested)
| Set the number of matches returned by the ibi™ Patterns - Search Server (default 10).
void | setStartMatch (int startMatch)
| Set the rank of the first match to be returned by the ibi™ Patterns - Search Server (default 1).
void | scoreType (score_types scoreType)
| This specifies the type of score to be used for ordering records.
void | scoreType (int scoreType)
| Obsolete. Use NetricsSearchOpts.scoreType(NetricsSearchOpts.score_types) instead.
void | useAbsoluteCutoff (double val)
| Cut off the result set at a specific absolute value.
void | useExactPlusScoreCutoff (int val)
| Return all search results which are exact matches and a constant number of records which are inexact.
void | usePercentOfTopCutoff (double val)
| Return search results whose scores are above a given percentage of the score of the first record.
void | useSimpleGapCutoff (double val)
| Return search results until there is gap between adjacent records.
void | useNoCutoff ()
| Revert to not using a cutoff.
void | setMatchEmpty (bool value)
| Sets the flag to match empty values.
void | setEmptyScore (double score)
| Sets the score a comparison gets when empty data is encountered.
void | setInvalidScore (double score)
| Sets the score a comparison gets when an error occurs.
void | setFailEmptyPred (bool fail)
| Set whether the predicate fails on empty data.
void | setFailInvalidPred (bool fail)
| Set whether a failed predicate is considered true or false.
void | baseColor (String color)
| Specify a non-match color for HTML text.
void | matchColor (String color)
| Specify a match color for HTML text.
void | baseBgColor (String color)
| Specify a background non-match color for HTML text.
void | matchBgColor (String color)
| Specify a background match color for HTML text.
void | maxFontSize (int val)
| Specify the maximum font size of matching text.
void | italicsThresh (int val)
| Specify the threshold beyond which to italicize text.
void | boldThresh (int val)
| Specify the threshold beyond which to bold text.
void | underlineThresh (int val)
| Specify the threshold beyond which to underline text.
void | useThesaurus (String name)
| Use the specified thesaurus in determining matching records.
void | useEphemeralThesaurus (NetricsBaseThesaurus thes_def)
| Use an empheral thesaurus in determining matching records.
void | setThesaurusWeight (double weight)
| Use the specified thesaurus weight in determining matching records.
void | addCustomTiebreak (int tiebreakId, int tiebreakParam)
| Can be used to specify how to break ties between two records that have identical textual similarity.
void | setFetchSize (int size)
| Tuning parameter, use only on the advice of your ibi representative.
void | setPCSize (int size)
| Tuning parameter, use only on the advice of your ibi representative.
void | setQCSize (int size)
| Tuning parameter, use only on the advice of your ibi representative.
void | setXparm (int id, int val)
| Use this method only on the advice of your ibi Patterns support representative.
void | setXparm (int id, double val)
| Use this method only on the advice of your ibi Patterns support representative.

## Detailed Description

This class is used to configure search options which apply for the overall search (for all tables being searched).

## Member Enumeration Documentation

## ◆ score_types

enum NetricsServerInterface.NetricsSearchOpts.score_types

An enumeration of all possible score types.

Enumerator
SCORE_NORMAL | This is the standard ibi™ Patterns - Search search with all weights and penalties applied. This type of search looks for the query text inside the record text. The presence of extra information in the record not found in the query does not penalize the record score. Use this score type for a substring or keyword search.
SCORE_SYMMETRIC | A symmetric search compares the full texts of both the query and record and evaluates their similarity. If the record contains information not present in the query, the score will be lower than if that information had not been present. Use this score only when the query represents the entirety of the text expected to be found.
SCORE_REVERSE | Reverse scoring functions the same as the normal search, but with the roles of the record and query reversed. Records are selected based on how well they match some piece of the query, with no penalty for unmatched sections of the query. Use this score type to categorize documents by using the document as a query against a table consisting of records of known keywords.
SCORE_MIN | Minimum of normal and reverse scores.
SCORE_MAX | Maximum of normal and reverse scores.
SCORE_IT | All three score types are computed and returned for each record and can be accessed using the getNormMatchScore, getRevMatchScore, and getSymMatchScore NetricsSearchResult methods. The getMatchScore method holds a copy of whichever match score was used to select and sort the records in the list.

## ◆ tiebreak_types

enum NetricsServerInterface.NetricsSearchOpts.tiebreak_types

An enumeration of all possible tiebreak types.

Enumerator
TIEBREAK_RECLEN | Deprecated: same as TIEBREAK_SCORETYPE Symmetric.
TIEBREAK_RECID | Sort on Record Key.
TIEBREAK_ALIGNMENT | Sort on Match Alignment.
TIEBREAK_SCORETYPE | Sort on score of specified type.
TIEBREAK_FIELDVAL | Sort on value in specified field.

## Member Function Documentation

## ◆ addCustomTiebreak()

void NetricsServerInterface.NetricsSearchOpts.addCustomTiebreak | ( | int | tiebreakId,
|  | int | tiebreakParam
| ) |  |
| inline

Can be used to specify how to break ties between two records that have identical textual similarity.

Each tiebreaking option has integer identifier and a possible integer parameter (most ignore the parameter). The tiebreaks are given in the table below.

NetricsSearchOpts.tiebreak_types.TIEBREAK_RECLEN | Deprecated. This is identical to TIEBREAK_SCORETYPE on symmetric score. | ignored
NetricsSearchOpts.tiebreak_types.TIEBREAK_RECID | By record key - this can be used to guarantee a stable sort of tied records | ignored
NetricsSearchOpts.tiebreak_types.TIEBREAK_ALIGNMENT | By querylet alignment - records which the query matches closer to the beginning will come first. This applies only to cognate or simple queries. | ignored
NetricsSearchOpts.tiebreak_types.TIEBREAK_SCORETYPE | By scoretype - you can tiebreak by a different scoretype than you're sorting on | The scoretype - described in NetricsSearchOpts.sortScore
NetricsSearchOpts.tiebreak_types.TIEBREAK_FIELDVAL | By field value - strings will be sorted from high to low and numeric values from low to high | The integer value of the field number to use (zero based)

Any number of tiebreaks may be added. The first tiebreak added will be the primary sort, the second will be the secondary sort, and so on (e.g. if the records are still tied after the first tiebreak, the second will then be used).

Parameters

  tiebreakId | One of the Ids specified in the table above.
  tiebreakParam | An int parameter which is explained in the table above.

## ◆ allowEmptyQueries()

void NetricsServerInterface.NetricsSearchOpts.allowEmptyQueries | ( | bool | allow | ) |
| inline

Sets whether queries with no searchable text throw an exception or return an empty result set. The default is to throw an exception.
The text of a query is all of the query strings in all Simple, Cognate, and Variable-attribute queries. A query has no searchable text when all of these strings, after applying the appropriate character-maps, contain only white-space.

Parameters

  allow | When true, queries with no search text will return an empty result set. When false, queries with no search text will throw a NetricsException with code NetricsException.error_codes.NOQUERY.

## ◆ baseBgColor()

void NetricsServerInterface.NetricsSearchOpts.baseBgColor | ( | String | color | ) |
| inline

Specify a background non-match color for HTML text.

Because ibi™ Patterns - Search returns a score per character in the matching record (see getCharMatchStrengths), the matching characters can be visualized based on the strength of the match at that position. For instance, the color red can be used to signify a strong match and the color blue can be used to signify a weak match. A gradient between the two colors can then be used to show matches of varying strengths. if you specify any of the following parameters, the visualization process will be done for you, and returned in the form of an HTML string per field in the record. The HTML strings can be accessed using the getHTMLStringByIndex method of the Record object. Each of the following parameters is used to customize the appearance of the HTML visualization.

Parameters

  color | The background color for a match can also be changed to indicate a match. This parameter represents the background color used to indicate a weak match.

## ◆ baseColor()

void NetricsServerInterface.NetricsSearchOpts.baseColor | ( | String | color | ) |
| inline

Specify a non-match color for HTML text.

Parameters

  color | All colors are specified as they are in an HTML document. The String should have 6 characters, each of which is a hex value (from 0 to F). The first two characters represent red, the second two represent green, and the last two represent blue. This parameter represents the color used to indicate a weak match.

See also
  NetricsSearchResult.getCharMatchStrengths(string)

## ◆ boldThresh()

void NetricsServerInterface.NetricsSearchOpts.boldThresh | ( | int | val | ) |
| inline

Specify the threshold beyond which to bold text.

Parameters

  val | This parameter represents the score for a character over which characters will be bolded (scores for characters returned from ibi™ Patterns - Search have a score from 0 to 6).

See also
  NetricsSearchOpts.setVisStyle(int)

Sample code of setting some search options

## ◆ emptyQueriesAllowed()

bool NetricsServerInterface.NetricsSearchOpts.emptyQueriesAllowed | ( |  | ) |
| inline

Returns
  true: empty queries will return an empty result set. false: empty queries will throw an exception.

## ◆ italicsThresh()

void NetricsServerInterface.NetricsSearchOpts.italicsThresh | ( | int | val | ) |
| inline

Specify the threshold beyond which to italicize text.

Parameters

  val | This parameter represents the score for a character over which characters will be italicized (scores for characters returned from ibi™ Patterns - Search have a score from 0 to 6).

See also
  NetricsSearchOpts.setVisStyle(int)

Sample code of setting some search options

## ◆ matchBgColor()

void NetricsServerInterface.NetricsSearchOpts.matchBgColor | ( | String | color | ) |
| inline

Specify a background match color for HTML text.

Parameters

  color | This parameter represents the background color used to indicate a strong match.

## ◆ matchColor()

void NetricsServerInterface.NetricsSearchOpts.matchColor | ( | String | color | ) |
| inline

Specify a match color for HTML text.

Parameters

  color | This parameter represents the color used to indicate a strong match.

## ◆ maxFontSize()

void NetricsServerInterface.NetricsSearchOpts.maxFontSize | ( | int | val | ) |
| inline

Specify the maximum font size of matching text.

Parameters

  val | This parameter represents the HTML font size to use for strong matches (ranges from 0 to 3).

## ◆ scoreType()

void NetricsServerInterface.NetricsSearchOpts.scoreType | ( | score_types | scoreType | ) |
| inline

This specifies the type of score to be used for ordering records.

Score types include the following:

Normal (pass in NetricsSearchOpts.score_types.SCORE_NORMAL). This is the standard ibi™ Patterns - Search search with all weights and penalties applied. This type of search looks for the query text inside the record text. The presence of extra information in the record not found in the query does not penalize the record score. Use this score type for a substring or keyword search.

Symmetric (pass in NetricsSearchOpts.score_types.SCORE_SYMMETRIC). A symmetric search compares the full texts of both the query and record and evaluates their similarity. If the record contains information not present in the query, the score will be lower than if that information had not been present. Use this score only when the query represents the entirety of the text expected to be found.

Reverse (pass in NetricsSearchOpts.score_types.SCORE_REVERSE). Reverse scoring functions the same as the normal search, but with the roles of the record and query reversed. Records are selected based on how well they match some piece of the query, with no penalty for unmatched sections of the query. Use this score type to categorize documents by using the document as a query against a table consisting of records of known keywords.

Minimum ( pass in NetricsSearchOpts.score_types.MINIMUM). Minimum of normal and reverse scores.

Maximum ( pass in NetricsSearchOpts.score_types.MAXIMUM). Maximum of normal and reverse scores.

Scoreit ( pass in NetricsSearchOpts.score_types.SCORE_IT). All five score types are computed and returned for each record and can be accessed using the getNormMatchScore, getRevMatchScore, getSymMatchScore, getMinMatchScore, and getMaxMatchScore NetricsSearchResult methods. The getMatchScore method holds a copy of whichever match score was used to select and sort the records in the list.

This sample code shows how to specify search options such as scoretype on a multi-query operation.

// This is an example of using some search options with a multi-query where different query strings
// can be used in a search across different fields within a table. This requires first configuring a
// Simple query for each query string along with the fields to be searched and then either "And" or "Or"
// them together. <br>
//
// In this we will query the "names" table using a query string against the "last" field and a another
// query string against the "first" field. Each of these queries are referred to as a querylet. We will
// apply a higher weight to the "last" field querylet.
using System;
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);
// Table is the <i>ibi Patterns - Search</i> table to be search/matched against query
String table = "names";
// Going to use 2 NetricsQuery for the search configuration
NetricsQuery[] nqs = new NetricsQuery[2];
// Create NetricsSearchOpts object and then set some options
NetricsSearchOpts opts = new NetricsSearchOpts();
<b>// Set the search to SYMMETRIC scoring mode
opts.scoreType(NetricsSearchOpts.score_types.SCORE_SYMMETRIC);</b>
// Set cutoff to exact matches plus the next 3 highest similarity score
opts.useExactPlusScoreCutoff(3);
// Set Empty Score to .2, eg. if field contains no data then use .2 score rather than 0.
opts.setEmptyScore(.2);
// Create the NetricsSearchCfg pointing to the table to be searched/matched against
NetricsSearchCfg tblCfg = new NetricsSearchCfg(table);
// Query will contain the query string for the first querylet which is "last
String query = "brown";
// 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" };
// Create a Simple query for the "last" names search
nqs[0] = NetricsQuery.Simple(query, fieldNames, null);
// Set up the second Simple query
query = "dennis";
fieldNames[0] = "first";
nqs[1] = NetricsQuery.Simple(query, fieldNames, null);
// QueryletWeights is an array that must be the same length as the number of querylets
// and is the weight applied to each querylet in the search which impacts the similarity
// scrore. In this case there will be two querylets that will be ANDed together to create
// a single search configuration
double[] queryletWeights = { 1.0, .5 };
// Now AND the two Simple querys together to create the final NetricsQuery for the search
NetricsQuery nqAnded = NetricsQuery.And(queryletWeights, nqs);
// Set the NetricsSearchCfg;
tblCfg.setNetricsQuery(nqAnded);
// 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.NetricsQuery.And
static NetricsQuery And(double[] weights, NetricsQuery[] nqs)
Create an AND Query Expression Node.
Definition: NetricsQuery.cs:581
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.NetricsSearchOpts.setEmptyScore
void setEmptyScore(double score)
Sets the score a comparison gets when empty data is encountered.
Definition: NetricsSearchOpts.cs:847
NetricsServerInterface.NetricsSearchOpts.scoreType
void scoreType(score_types scoreType)
This specifies the type of score to be used for ordering records.
Definition: NetricsSearchOpts.cs:561
NetricsServerInterface.NetricsSearchOpts.useExactPlusScoreCutoff
void useExactPlusScoreCutoff(int val)
Return all search results which are exact matches and a constant number of records which are inexact.
Definition: NetricsSearchOpts.cs:694
NetricsServerInterface.NetricsSearchOpts.score_types
score_types
An enumeration of all possible score types.
Definition: NetricsSearchOpts.cs:405
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.NetricsServerInterface.search
NetricsSearchResponse search(NetricsSearchCfg cfg, NetricsSearchOpts opts)
Version of search to search a single table.
Definition: NetricsServerInterface.cs:1321
NetricsServerInterface
ibi™ Patterns - Search .NET Interface Overview.
Definition: BaseObjectStats.cs:14

## ◆ setDetailedStats()

void NetricsServerInterface.NetricsSearchOpts.setDetailedStats | ( | bool | enabled | ) |
| inline

Enable detailed statistics for this search.

Detailed statistics will return information which can be used by your ibi Patterns support representative, but should be off by default as it will decrease search performance.

## ◆ setEmptyScore()

void NetricsServerInterface.NetricsSearchOpts.setEmptyScore | ( | double | score | ) |
| inline

Sets the score a comparison gets when empty data is encountered.

A comparison will receive this score when empty data is encountered. In some situations it is more appropriate to set this score to 0.0 or -1.0, and the user is therefore allowed to configure this setting.

This sample code shows how to specify search options such as emptyscore on a multi-query operation.

// This is an example of using some search options with a multi-query where different query strings
// can be used in a search across different fields within a table. This requires first configuring a
// Simple query for each query string along with the fields to be searched and then either "And" or "Or"
// them together. <br>
//
// In this we will query the "names" table using a query string against the "last" field and a another
// query string against the "first" field. Each of these queries are referred to as a querylet. We will
// apply a higher weight to the "last" field querylet.
using System;
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);
// Table is the <i>ibi Patterns - Search</i> table to be search/matched against query
String table = "names";
// Going to use 2 NetricsQuery for the search configuration
NetricsQuery[] nqs = new NetricsQuery[2];
// Create NetricsSearchOpts object and then set some options
NetricsSearchOpts opts = new NetricsSearchOpts();
// Set the search to SYMMETRIC scoring mode
opts.scoreType(NetricsSearchOpts.score_types.SCORE_SYMMETRIC);
// Set cutoff to exact matches plus the next 3 highest similarity score
opts.useExactPlusScoreCutoff(3);
<b>// Set Empty Score to .2, eg. if field contains no data then use .2 score rather than 0.
opts.setEmptyScore(.2);</b>
// Create the NetricsSearchCfg pointing to the table to be searched/matched against
NetricsSearchCfg tblCfg = new NetricsSearchCfg(table);
// Query will contain the query string for the first querylet which is "last
String query = "brown";
// 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" };
// Create a Simple query for the "last" names search
nqs[0] = NetricsQuery.Simple(query, fieldNames, null);
// Set up the second Simple query
query = "dennis";
fieldNames[0] = "first";
nqs[1] = NetricsQuery.Simple(query, fieldNames, null);
// QueryletWeights is an array that must be the same length as the number of querylets
// and is the weight applied to each querylet in the search which impacts the similarity
// scrore. In this case there will be two querylets that will be ANDed together to create
// a single search configuration
double[] queryletWeights = { 1.0, .5 };
// Now AND the two Simple querys together to create the final NetricsQuery for the search
NetricsQuery nqAnded = NetricsQuery.And(queryletWeights, nqs);
// Set the NetricsSearchCfg;
tblCfg.setNetricsQuery(nqAnded);
// 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");
}
}
}

## ◆ setFailEmptyPred()

void NetricsServerInterface.NetricsSearchOpts.setFailEmptyPred | ( | bool | fail | ) |
| inline

Set whether the predicate fails on empty data.

This applies to filtering predicates. If this is true predicates that encounter empty data, either in the query or record value, fail. The treatment of the failed predicate is then controlled by the setting of the Invalid Predicate flag. If this is false the predicate is evaluated against the empty data assuming a default value appropriate to the data type of the field.

The default value for this flag is true.

See also
  NetricsSearchOpts.setFailInvalidPred(bool)

## ◆ setFailInvalidPred()

void NetricsServerInterface.NetricsSearchOpts.setFailInvalidPred | ( | bool | fail | ) |
| inline

Set whether a failed predicate is considered true or false.

This applies to filtering predicates. It controls how failed predicates are treated. A predicate fails if:

An invalid data value, either in the query or record data, is encountered.

An empty date value, either in the query or record data, is encountered and the Fail Empty Predicate flag is true.

A conversion is requested on data that can't be converted to the requested type.

Other rare conditions may cause a failure.

If this flag is true a failed predicate is treated as a false value, i.e. the record is not returned. If this value is false a failed predicate is treated as true, i.e. the test is considered to have passed even if other clauses in the test returned false.

For example:

( $&quot;count&quot; < 10 ) and ( DATE $&quot;issue-date&quot; > DATE &quot;10/10/2010&quot; )

If the value of "issue-date" is "notadate", causing the conversion to fail, and the Fail Invalid Predicate flag is set to false, the test returns true even if "count" is greater then 10.

This flag should be set to false only after careful consideration of the above.

The default value is true.

## ◆ setGipFiltered()

void NetricsServerInterface.NetricsSearchOpts.setGipFiltered | ( | bool | enabled | ) |
| inline

Enable GIP filtering for this table (default). Available only if the GIP filter was enabled in the server and the table was loaded with GIP filtering enabled. GIP filtering will greatly speed up the performance of the server for large data sets.

Parameters

  enabled | new value for the GIP filtering setting.

## ◆ setGpuCallParallelism()

void NetricsServerInterface.NetricsSearchOpts.setGpuCallParallelism | ( | int? | count | ) |
| inline

Set the number of simultaneous GPU calls used in the search.

Parameters

  count | The number of simultaneous GPU calls used in the search. Pass null to use the server's default value.

See the programmers guide for default and limits.

## ◆ setGpuEnabled()

void NetricsServerInterface.NetricsSearchOpts.setGpuEnabled | ( | Boolean? | enabled | ) |
| inline

Set whether the search uses GPU-enabled indexing.

Parameters

  enabled | True: use gpu-enabled indexing. If the table is not gpu-enabled the search will fail.False: do not use gpu-enabled indexing.null: use gpu-enabled indexing only if the table is gpu-enabled.

## ◆ setGpuTableBlocksPerCall()

void NetricsServerInterface.NetricsSearchOpts.setGpuTableBlocksPerCall | ( | int? | count | ) |
| inline

Set the number of table-blocks evaluated per GPU call.

Parameters

  count | The number of table-blocks evaluated per GPU call. Pass null to use the server's default value.

See the programmers guide for default and limits.

## ◆ setInvalidScore()

void NetricsServerInterface.NetricsSearchOpts.setInvalidScore | ( | double | score | ) |
| inline

Sets the score a comparison gets when an error occurs.

A comparison will receive this score when an error occurs such as an invalid date in a date type field or invalid data in a numerics type field. In some situations it is more appropriate to set this score to 0.0 or -1.0, and the user is therefore allowed to configure this setting.

This sample code shows how to specify search options such as invalidscore on a multi-query operation.

// This is an example of using some search options with a multi-query using both a Simple and Predicate query.
// This requires first configuring a Simple query using the query string along with the fields to be searched
// followed by configuring a Predicate query and then either "And" or "Or" them together. <br>
//
// In this we will query the "names" table using a query string against the "last" field and then configuring
// the Predicate query to look for the year 2001 in the DOB field which is a date field. If the DOB field contains
// an invalid date we will assign a score of .2 by using the setInvalidScore method. Each of these queries are referred
// to as a querylet. We will apply a higher weight to the "last" field querylet.
using System;
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);
// Table is the <i>ibi Patterns - Search</i> table to be search/matched against query
String table = "names";
// Going to use 2 NetricsQuery for the search configuration
NetricsQuery[] nqs = new NetricsQuery[2];
// Create NetricsSearchOpts object and then set some options
NetricsSearchOpts opts = new NetricsSearchOpts();
// Set the search to SYMMETRIC scoring mode
opts.scoreType(NetricsSearchOpts.score_types.SCORE_SYMMETRIC);
// Set cutoff to exact matches plus the next 3 highest similarity score
opts.useExactPlusScoreCutoff(3);
// Create the NetricsSearchCfg pointing to the table to be searched/matched against
NetricsSearchCfg tblCfg = new NetricsSearchCfg(table);
// Query will contain the query string for the first querylet which is "last
String query = "brown";
// 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" };
// Create a Simple query for the "last" names search
nqs[0] = NetricsQuery.Simple(query, fieldNames, null);
// Set up the second query of type Predicate
nqs[1] = NetricsQuery.Predicate("\"2001\" IN $\"DOB\"");
// Set the invalid score to .2 if the DOB field contains an invalid date
nqs[1].setInvalidScore(.2);
// QueryletWeights is an array that must be the same length as the number of querylets
// and is the weight applied to each querylet in the search which impacts the similarity
// scrore. In this case there will be two querylets that will be ANDed together to create
// a single search configuration
double[] queryletWeights = { 1.0, .5 };
// Now AND the two Simple querys together to create the final NetricsQuery for the search
NetricsQuery nqAnded = NetricsQuery.And(queryletWeights, nqs);
// Set the NetricsSearchCfg;
tblCfg.setNetricsQuery(nqAnded);
// 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.NetricsQuery.Predicate
static NetricsQuery Predicate(NetricsPredicate pred)
Create an Predicate Query Expression Node.
Definition: NetricsQuery.cs:1971
NetricsServerInterface.NetricsQuery.setInvalidScore
void setInvalidScore(double score)
Sets the score a comparison gets when an error occurs.
Definition: NetricsQuery.cs:2328

## ◆ setMatchEmpty()

void NetricsServerInterface.NetricsSearchOpts.setMatchEmpty | ( | bool | value | ) |
| inline

Sets the flag to match empty values.

This is the same as the NetricsQuery.setMatchEmpty(bool) method, but applies to all querylets that do not explicitly set their own Match Empty flag.

value - the value of the Match Empty flag.

See also
  NetricsQuery.setMatchEmpty(bool)

## ◆ setMatchesRequested()

void NetricsServerInterface.NetricsSearchOpts.setMatchesRequested | ( | int | matchesRequested | ) |
| inline

Set the number of matches returned by the ibi™ Patterns - Search Server (default 10).

Parameters

  matchesRequested | The number of matches requested

## ◆ setPhonetic()

void NetricsServerInterface.NetricsSearchOpts.setPhonetic | ( | bool | enabled | ) |
| inline

Enable phonetic searches for this table.

Available only in the Phonetics Version of the ibi™ Patterns - Search Server. Phonetics must be enabled at load time to perform phonetic searches (it is on by default in a Phonetics version server).

## ◆ setPsiDensity()

void NetricsServerInterface.NetricsSearchOpts.setPsiDensity | ( | NetricsTable::PsiDensity | density | ) |
| inline

Set the density of suffixes produced from query field values. It is recommended that you contact your ibi representative for advice before using this option.

Parameters

  density | See NetricsTable.PsiDensity

## ◆ setPsiFiltered()

void NetricsServerInterface.NetricsSearchOpts.setPsiFiltered | ( | bool | enabled | ) |
| inline

Enable PSI filtering for this table. Available only if the PSI filter was enabled in the server and the table was loaded with PSI filtering enabled. PSI filtering will greatly speed up the performance of the server for large data sets. To use PSI filtering it must be enabled at load time, and setPsiLookupFields() must be called.

Parameters

  enabled | new value for the PSI filtering setting.

## ◆ setPsiLookupFields()

void NetricsServerInterface.NetricsSearchOpts.setPsiLookupFields | ( | String[] | fields | ) |
| inline

Set the fields used to lookup a record in the sort filter.

You should only use this method with the help of your ibi technical support representative.

As the sortfilter is predominantly used in a record linking scenario, a query of the it is expected to contain the same structure as the fields of the table, Therefore, the number and structure of fields in this array must be the same as that for the table.

## ◆ setRlModelName()

void NetricsServerInterface.NetricsSearchOpts.setRlModelName | ( | String | name | ) |
| inline

This method specifies the rlink model name to use for this search.

You should only use this method with the help of your ibi technical support representative.

When you are using a Learn Model, you must use the same query structure that was used to create it. For instance, if there were five features used to train the model, five features which represent the same meaning must still be used. In the simplest case, a five featured model will translate to five querylets. The user would simply call AddQuery five times with the appropriate fields, the querylet scores would automatically be used as feature scores, and the user would receive a Learn Model score in the NetricsSearchResult objects (see getRlScore). If more complicated features were used in the construction of the model, they should also be used when querying the model. To understand this, see setRlQueryletKey and setRlPreds.

See also
  NetricsSearchResult.getRlScore

## ◆ setRlPreds()

void NetricsServerInterface.NetricsSearchOpts.setRlPreds | ( | NetricsPredicate[] | preds | ) |
| inline

Set the predicates used as features by the ibi™ Patterns - Search Learn Model.

You should only use this method with the help of your ibi technical support representative.

It is often useful to specify features in a Learn Model using a strict 1.0/0.0 scoring. ibi™ Patterns - Search inexact matching technology is therfore inappropriate for this. Instead, you should use NetricsPredicates to specify strict conditions constructed from the fields of the query and table. If the predicate evaluates to true, the feature score will equal 1.0. Otherwise it will equal 0.0. For instance, this would be used if you wanted a feature to indicate that the gender of the query record is the same as that of the table record.

## ◆ setSortFiltered()

void NetricsServerInterface.NetricsSearchOpts.setSortFiltered | ( | bool | enabled | ) |
| inline

Enable SORT filtering for this table. Available only if the SORT filter was enabled in the server and the table was loaded with SORT filtering enabled. SORT filtering will greatly speed up the performance of the server for large data sets. To use SORT filtering it must be enabled at load time, and setSortLookupFields() must be called.

Parameters

  enabled | new value for the SORT filtering setting.

## ◆ setSortLookupFields()

void NetricsServerInterface.NetricsSearchOpts.setSortLookupFields | ( | String[] | fields | ) |
| inline

Set the fields used to lookup a record in the sort filter.

You should only use this method with the help of your ibi technical support representative.

As the sortfilter is predominantly used in a record linking scenario, a query of the it is expected to contain the same structure as the fields of the table, Therefore, the number and structure of fields in this array must be the same as that for the table.

## ◆ setStartMatch()

void NetricsServerInterface.NetricsSearchOpts.setStartMatch | ( | int | startMatch | ) |
| inline

Set the rank of the first match to be returned by the ibi™ Patterns - Search Server (default 1).

For instance, if startMatch is set to 11 and matchesRequested is set to 10, the server will return matches 11 through 20.

Parameters

  startMatch | The rank of the first match.

## ◆ setThesaurusWeight()

void NetricsServerInterface.NetricsSearchOpts.setThesaurusWeight | ( | double | weight | ) |
| inline

Use the specified thesaurus weight in determining matching records.

Parameters

  weight | Specifies a thesaurus weight to use for the query (from 0.0 to 1.0). A weight of 1.0 means that the score associated with a matching thesaurus word will be exactly equivalent to the score which matches the query as entered. If a weight less than 1.0 is given, then the score of records matched based on thesaurus substitutions will be decreased.

See also
  NetricsServerInterface.thcreate

## ◆ setVisStyle()

void NetricsServerInterface.NetricsSearchOpts.setVisStyle | ( | int | styleNo | ) |
| inline

Sets the visualization style you want returned.

The definition is as follows:

0: | no visualization (default)
2: | return the match strength arrays in the NetricsSearchResults object.
256: | Return the HTML visualization strings.

This sample code shows how to specify search options such as setVisStyle on a multi-query operation.

// This is an example of using some search options with a multi-query where different query strings
// can be used in a search across different fields within a table. This requires first configuring a
// Simple query for each query string along with the fields to be searched and then either "And" or "Or"
// them together. <br>
//
// In this we will query the "names" table using a query string against the "last" field and a another
// query string against the "first" field. Each of these queries are referred to as a querylet. We will
// apply a higher weight to the "last" field querylet.
using System;
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);
// Table is the <i>ibi Patterns - Search</i> table to be search/matched against query
String table = "names";
// Going to use 2 NetricsQuery for the search configuration
NetricsQuery[] nqs = new NetricsQuery[2];
// Create NetricsSearchOpts object and then set some options
NetricsSearchOpts opts = new NetricsSearchOpts();
// Set the search to SYMMETRIC scoring mode
opts.scoreType(NetricsSearchOpts.score_types.SCORE_SYMMETRIC);
// Set cutoff to exact matches plus the next 3 highest similarity score
opts.useExactPlusScoreCutoff(3);
// Set Empty Score to .2, eg. if field contains no data then use .2 score rather than 0.
opts.setEmptyScore(.2);
// Set visualization to html to add HTML tags to output to see text withing the records
// which contribute to the similarity score. We'll need to use the getHTML method on the
<b>// NetricsSearchResult for the visualization data
opts.setVisStyle(256);
// If you want bold tags with HTML then set boldThresh to 2
opts.boldThresh(2);</b>
// Create the NetricsSearchCfg pointing to the table to be searched/matched against
NetricsSearchCfg tblCfg = new NetricsSearchCfg(table);
// Query will contain the query string for the first querylet which is "last
String query = "brown";
// 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" };
// Create a Simple query for the "last" names search
nqs[0] = NetricsQuery.Simple(query, fieldNames, null);
// Set up the second Simple query
query = "dennis";
fieldNames[0] = "first";
nqs[1] = NetricsQuery.Simple(query, fieldNames, null);
// QueryletWeights is an array that must be the same length as the number of querylets
// and is the weight applied to each querylet in the search which impacts the similarity
// scrore. In this case there will be two querylets that will be ANDed together to create
// a single search configuration
double[] queryletWeights = { 1.0, .5 };
// Now AND the two Simple querys together to create the final NetricsQuery for the search
NetricsQuery nqAnded = NetricsQuery.And(queryletWeights, nqs);
// Set the NetricsSearchCfg;
tblCfg.setNetricsQuery(nqAnded);
// 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();
xfields = new String[res[0].getFieldNames().Length];
// Get the HTML data for each field in result record
for (int fieldIdx = 0; fieldIdx < xfieldNames.Length; fieldIdx++ )
{
xfields[fieldIdx] = res[i].getHtml(fieldIdx);
} <br>
// 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.NetricsSearchOpts.setVisStyle
void setVisStyle(int styleNo)
Sets the visualization style you want returned.
Definition: NetricsSearchOpts.cs:375
NetricsServerInterface.NetricsSearchOpts.boldThresh
void boldThresh(int val)
Specify the threshold beyond which to bold text.
Definition: NetricsSearchOpts.cs:1159

See also
  NetricsSearchResult.getCharMatchStrengths(string)

## ◆ underlineThresh()

void NetricsServerInterface.NetricsSearchOpts.underlineThresh | ( | int | val | ) |
| inline

Specify the threshold beyond which to underline text.

Parameters

  val | This parameter represents the score for a character over which characters will be underlined (scores for characters returned from ibi™ Patterns - Search have a score from 0 to 6).

See also
  NetricsSearchOpts.setVisStyle(int)

Sample code of setting some search options

## ◆ useAbsoluteCutoff()

void NetricsServerInterface.NetricsSearchOpts.useAbsoluteCutoff | ( | double | val | ) |
| inline

Cut off the result set at a specific absolute value.

If one wants to use one of the dynamic cutoffs below as well as an absolute cutoff, post-processing the results to enforce the absolute cutoff may be better than setting it here.

Parameters

  val | The percentage at which to cut off.

See also
  NetricsSearchOpts.useExactPlusScoreCutoff(int)

Sample code of setting some search options

## ◆ useEphemeralThesaurus()

void NetricsServerInterface.NetricsSearchOpts.useEphemeralThesaurus | ( | NetricsBaseThesaurus | thes_def | ) |
| inline

Use an empheral thesaurus in determining matching records.

An ephmeral thesaurus is on that exists only for the duration of a single query and is accessible ony by that query. The thesaurus name, although required for consistency, is not used. Thus ephemeral thesauri may have the same name as a permanent thesaurus or another ephemeral thesaurus without causing interference.

Ephemeral thesauri are inteded for those cases where possible sutstitutions or weighted terms for a query are generated dynamically based on the query and is not a fixed set of substitutions or weightings that can be encoded into a static thesaurus.

Parameters

  thes_def | A Thesarus object (any extension of NetricsBaseThesaurus).

See also
  NetricsThesaurus, NetricsCombinedThesaurus, NetricsWeightedDictionary

## ◆ useExactPlusScoreCutoff()

void NetricsServerInterface.NetricsSearchOpts.useExactPlusScoreCutoff | ( | int | val | ) |
| inline

Return all search results which are exact matches and a constant number of records which are inexact.

Because it is inappropriate to cut off search results at a static score threshold, there are several configurable dynamic methods which can be used. All cutoffs will use the score type specified in the scoreType property. Only one cutoff may be used at a time. The most recent cutoff specified is the one that will be used.

This cutoff returns all exact matches plus a constant number of records.

This sample code shows how to specify search options such as useExactPlusScoreCutoff to limit the the size of the output on a multi-query operation.

// This is an example of using some search options with a multi-query where different query strings
// can be used in a search across different fields within a table. This requires first configuring a
// Simple query for each query string along with the fields to be searched and then either "And" or "Or"
// them together. <br>
//
// In this we will query the "names" table using a query string against the "last" field and a another
// query string against the "first" field. Each of these queries are referred to as a querylet. We will
// apply a higher weight to the "last" field querylet.
using System;
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);
// Table is the <i>ibi Patterns - Search</i> table to be search/matched against query
String table = "names";
// Going to use 2 NetricsQuery for the search configuration
NetricsQuery[] nqs = new NetricsQuery[2];
// Create NetricsSearchOpts object and then set some options
NetricsSearchOpts opts = new NetricsSearchOpts();
// Set the search to SYMMETRIC scoring mode
opts.scoreType(NetricsSearchOpts.score_types.SCORE_SYMMETRIC);
<b>// Set cutoff to exact matches plus the next 3 highest similarity score
opts.useExactPlusScoreCutoff(3);</b>
// Set Empty Score to .2, eg. if field contains no data then use .2 score rather than 0.
opts.setEmptyScore(.2);
// Create the NetricsSearchCfg pointing to the table to be searched/matched against
NetricsSearchCfg tblCfg = new NetricsSearchCfg(table);
// Query will contain the query string for the first querylet which is "last
String query = "brown";
// 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" };
// Create a Simple query for the "last" names search
nqs[0] = NetricsQuery.Simple(query, fieldNames, null);
// Set up the second Simple query
query = "dennis";
fieldNames[0] = "first";
nqs[1] = NetricsQuery.Simple(query, fieldNames, null);
// QueryletWeights is an array that must be the same length as the number of querylets
// and is the weight applied to each querylet in the search which impacts the similarity
// scrore. In this case there will be two querylets that will be ANDed together to create
// a single search configuration
double[] queryletWeights = { 1.0, .5 };
// Now AND the two Simple querys together to create the final NetricsQuery for the search
NetricsQuery nqAnded = NetricsQuery.And(queryletWeights, nqs);
// Set the NetricsSearchCfg;
tblCfg.setNetricsQuery(nqAnded);
// 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");
}
}
}

Parameters

  val | The number of records to return in addition to the exact matches.

## ◆ useNoCutoff()

void NetricsServerInterface.NetricsSearchOpts.useNoCutoff | ( |  | ) |
| inline

Revert to not using a cutoff.

This method is used to specify that no cutoff should be used. Although this happens by default, the useNoCutoff method can be useful after a call to one of the above methods.

See also
  NetricsSearchOpts.useExactPlusScoreCutoff(int)

Sample code of setting some search options

## ◆ usePercentOfTopCutoff()

void NetricsServerInterface.NetricsSearchOpts.usePercentOfTopCutoff | ( | double | val | ) |
| inline

Return search results whose scores are above a given percentage of the score of the first record.

This cutoff returns the first match plus all record above a certain percentage of the first match.

Parameters

  val | The percentage of the first records score for which no records below that score will be returned. (Valid range is from 0.0 to 100.0)

See also
  NetricsSearchOpts.useExactPlusScoreCutoff(int)

Sample code of setting some search options

## ◆ useSimpleGapCutoff()

void NetricsServerInterface.NetricsSearchOpts.useSimpleGapCutoff | ( | double | val | ) |
| inline

Return search results until there is gap between adjacent records.

This cutoff returns the first match and all records until a gap is found between the scores of consecutive records greater than a certain percentage of the score of the first record.

Parameters

  val | The percentage of the first record's score which will be used to look for a gap between the scores of consecutive records below which no records will be returned. (Valid range is from 0.0 to 100.0)

See also
  NetricsSearchOpts.useExactPlusScoreCutoff(int)

Sample code of setting some search options

## ◆ useThesaurus()

void NetricsServerInterface.NetricsSearchOpts.useThesaurus | ( | String | name | ) |
| inline

Use the specified thesaurus in determining matching records.

This sample shows how to perform a search of an ibi™ Patterns - Search table and apply a thesaurus to a query.

// The following is an example of a multi-query where different query strings can be used in a search across
// different fields within a table. This requires first configuring a Simple query for each query
// string along with the fields to be searched, and then either "And" or "Or" them together. In this
// example we will query the "names" table using a query string against the "last" field and a another query
// string against the "first" field. Each of these queries are referred to as a querylet. We will
// apply a higher weight to the "last" field querylet and apply a the "nicknames" thesaurus to the overall query
// treating the related terms within the thesaurus and the query string as equivalent.
using System;
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);
// Table is the <i>ibi Patterns - Search</i> table to be search/matched against query
String table = "names";
// Going to use 2 NetricsQuery for the search configuration
NetricsQuery[] nqs = new NetricsQuery[2];
// Create NetricsSearchOpts object using the defaults
NetricsSearchOpts opts = new NetricsSearchOpts();
// Set up the query to use the nicknames thesaurus. i.e. "Den" is equivalent to "Dennis".
opts.useThesaurus("nicknames");
// Create the NetricsSearchCfg pointing to the table to be searched/matched against
NetricsSearchCfg tblCfg = new NetricsSearchCfg(table);
// Query will contain the query string for the first querylet which is "last
String query = "brown";
// 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" };
// Create a Simple query for the "last" names search
nqs[0] = NetricsQuery.Simple(query, fieldNames, null);
// Set up the second Simple query
query = "den";
fieldNames[0] = "first";
nqs[1] = NetricsQuery.Simple(query, fieldNames, null);
// QueryletWeights is an array that must be the same length as the number of querylets
// and is the weight applied to each querylet in the search which impacts the similarity
// scrore. In this case there will be two querylets that will be ANDed together to create
// a single search configuration
double[] queryletWeights = { 1.0, .5 };
// Now AND the two Simple querys together to create the final NetricsQuery for the search
NetricsQuery nqAnded = NetricsQuery.And(queryletWeights, nqs);
// Set the NetricsSearchCfg;
tblCfg.setNetricsQuery(nqAnded);
// 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.NetricsSearchOpts.useThesaurus
void useThesaurus(String name)
Use the specified thesaurus in determining matching records.
Definition: NetricsSearchOpts.cs:1267

Parameters

  name | Specifies which thesaurus to use for the query. The string should be the name of the thesaurus as passed to the thCreate method of the NetricsServerInterface object.

See also
  NetricsServerInterface.thcreate