NetricsQuery objects are used to implement the complex query structures introduced with release 4.1.


Namespace: NetricsServerInterface
Assembly: NetricsServerInterface (in NetricsServerInterface.dll)

Syntax

Visual Basic (Declaration)
<GuidAttribute("9CCB9FFC-6975-4428-A536-50782534805C")>
Public Class NetricsQuery
    Implements INetricsQuery
C#
[GuidAttribute("9CCB9FFC-6975-4428-A536-50782534805C")]
public class NetricsQuery : INetricsQuery
C++
[GuidAttribute(L"9CCB9FFC-6975-4428-A536-50782534805C")]
ref class NetricsQuery : INetricsQuery
J#
/** @attribute GuidAttribute("9CCB9FFC-6975-4428-A536-50782534805C") */
public class NetricsQuery implements INetricsQuery
JScript
public 
   GuidAttribute("9CCB9FFC-6975-4428-A536-50782534805C")
class NetricsQuery extends INetricsQuery

Remarks

Queries now take the form of a hierarchial tree. There are currently four ways to create basic scores - a simple query comparison, a cognate query comparison, a date comparison, and a predicate querylet. This will be explained in further detail below. These scores can then be combined by five more operators - AND, OR, NOT, WGTBYFIELD and RLINK (this last is how to use the Decision Engine model provided to you by netrics if you purchased the Decision Engine). For each of the score combiners, you will need to pass the NetricsQuery "children" which will be combined by that operator. It follows that all the "leaves" in the tree will need to be score generators, and all the "branches" will need to be score combiners. To create the most basic search, just follow the following code:

 Copy Code
                NetricsSearchCfg tblCfg = new NetricsSearchCfg("test");
                tblCfg.setNetricsQuery(new NetricsQuery("Michael Phelps",null,null));
                    
                NetricsSearchResponse resp = si.search(tblCfg, null);
                    
The above code will search the database "test" (all fields) for the string "Michael Phelps." It's just that easy. A much more complicated search might look like the following:
 Copy Code
                String []fnames = {"name1"};
                NetricsQuery nq1 = NetricsQuery.Simple("rec1f1",fnames,null);
            
                String []queries = {"rec1f2","rec1f1"};
                String []fnames2 = {"name1","name2"};
                NetricsQuery nq2 = NetricsQuery.Cognate(queries,fnames2,null,.8);
            
                String []fnames3 = {"date"};
                NetricsQuery nq3 = NetricsQuery.Custom("10/12/2001",fnames3,null,NetricsQuery.CS_DATE);
            
                NetricsQuery nq4 = NetricsQuery.Predicate("DATE \"2001/01/01\" <= $\" $\"date\" and $\"date\" <= DATE \"2001/12/31\"");
            
                NetricsQuery []nqs = {nq1,nq2,nq3,nq4};
                NetricsQuery nq = NetricsQuery.And(null,nqs);
                    
The above query combines 4 different querylets using an AND (which performs a simple average of the individual scores. The first querylet is a simple string comparison, the second is a cognate string comparison, the third is a date comparison, and the fourth is a predicate comparison. Look below to find out more about each kind of query.

Inheritance Hierarchy

System.Object
   NetricsServerInterface.NetricsQuery

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also