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)
Public Class NetricsQuery
C#
public class NetricsQuery
C++
ref class NetricsQuery
J#
public class NetricsQuery
JScript
public class NetricsQuery

Remarks

Queries now take the form of a hierarchial tree. There are currently five ways to create basic scores - a simple query comparison, a cognate query comparison, a date comparison, a predicate querylet and the Attributes Query. 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 Learn Model). 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 table "test" (all searchable text 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,0.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