public class NetricsTable
extends java.lang.Object
Its purpose is to allow the user to construct and configure a table object to be loaded into a TIBCO Patterns server.
| Modifier and Type | Field and Description |
|---|---|
static int |
FLDTYP_ATTRS
Name/Value attributes value field.
|
static int |
FLDTYP_DATE
Date value field.
|
static int |
FLDTYP_DATETIME
Date and time value field.
|
static int |
FLDTYP_FLOAT
Floating point value field.
|
static int |
FLDTYP_INT
Integer value field.
|
static int |
FLDTYP_KEY
Special field type for record key fields.
|
static int |
FLDTYP_PARENTKEY
Special field type for parent-key fields.
|
static int |
FLDTYP_SRCHDATE
Indexed date value field.
|
static int |
FLDTYP_SRCHTEXT
Searchable text field.
|
static int |
FLDTYP_TEXT
Non-searchable text field.
|
static int |
PSI_DENSITY_DENSE |
static int |
PSI_DENSITY_SPARSE |
static int |
PSI_DENSITY_STANDARD |
static java.lang.String |
RECORD_LIST_TABLE_NAME
The special table name for score records results.
|
| Constructor and Description |
|---|
NetricsTable(java.lang.String name,
java.lang.Boolean is_parent,
java.lang.String[] fieldNames,
NetricsRecSrc src)
Define a standard or parent table.
|
NetricsTable(java.lang.String name,
java.lang.String[] fieldNames,
NetricsRecSrc src)
Define a standard table.
|
NetricsTable(java.lang.String name,
java.lang.String parent_tbl,
java.lang.String[] fieldNames,
NetricsRecSrc src)
Create a standard or child table.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPIndex(java.lang.String field_name,
boolean primary,
java.lang.String[] partition_separators,
boolean normalized)
Add a partition index to this table.
|
java.lang.String |
compare(NetricsTable tbl)
For internal use only.
|
java.lang.String[] |
getFieldNames()
Can be used to get the field names from a NetricsTable returned by a tbldump.
|
java.lang.String |
getInfo()
Can be used to get the table info from a NetricsTable returned by a tbldump.
|
java.lang.String |
getName()
Return the name of this table.
|
NetricsRecSrc |
getRecSrc()
Retrieve the NetricsRecSrc for a NetricsTable returned by a tbldump.
|
java.lang.String |
getString()
An unformatted string representation of the table.
|
boolean |
isGipFiltered()
Return true if this table uses the GIP prefilter.
|
boolean |
isPsiFiltered()
Return true if this table uses the PSI prefilter.
|
boolean |
isSortFiltered()
Return true if this table uses the SORT prefilter.
|
void |
setCharmaps(java.lang.String[] charmaps)
Specifies the character map to use for each field.
|
void |
setEstNumRecords(int est_num)
Set the estimated number of records.
|
void |
setFieldTypes(int[] ftypes)
Specify the field types for this table.
|
void |
setGipFiltered(boolean enabled)
Enable GIP filtering for this table.
|
void |
setGipGramLen(int glen)
This method sets the gram length for the enterprise filter.
|
void |
setGpuDevices(int[] device_ids)
Select the GPU devices this tables uses for GPU-accelerated indexing.
|
void |
setGpuIndexing(java.lang.Boolean enabled)
Set whether this table uses GPU-accelerated indexing.
|
void |
setInfo(java.lang.String info)
Set the table info string.
|
void |
setPhonetic(boolean enabled)
Enable or disable phonetic searches for this table.
|
void |
setPsiDensity(int density)
Set the density of suffixes produced from record field values.
|
void |
setPsiEncodings(NetricsPsiEncoding... encodings)
Specifies encodings for the PSI pre-filter.
|
void |
setPsiEncodings(java.lang.String[][] encodings,
int[][] backwards_fields,
int[] suffixed_fields,
int[][] min_match_sizes)
Deprecated.
|
void |
setPsiEncodings(java.lang.String[][] encodings,
int[][] backwards_fields,
int[] suffixed_fields,
int[][] min_match_sizes,
java.lang.Integer[] densities)
Deprecated.
|
void |
setPsiFiltered(boolean enabled)
Enable PSI filtering for this table.
|
void |
setSortEncodings(NetricsSortEncoding... encodings)
Specifies encodings for the SORT pre-filter.
|
void |
setSortEncodings(java.lang.String[][] encodings,
int[][] backwards_fields)
Deprecated.
|
void |
setSortFiltered(boolean enabled)
Enable SORT filtering for this table.
|
public static final java.lang.String RECORD_LIST_TABLE_NAME
public static final int FLDTYP_KEY
public static final int FLDTYP_TEXT
public static final int FLDTYP_SRCHTEXT
public static final int FLDTYP_INT
public static final int FLDTYP_FLOAT
public static final int FLDTYP_DATE
public static final int FLDTYP_SRCHDATE
public static final int FLDTYP_DATETIME
public static final int FLDTYP_ATTRS
public static final int FLDTYP_PARENTKEY
public static final int PSI_DENSITY_DENSE
public static final int PSI_DENSITY_STANDARD
public static final int PSI_DENSITY_SPARSE
public NetricsTable(java.lang.String name,
java.lang.String[] fieldNames,
NetricsRecSrc src)
name - The name of the table. Must be unique. In other commands,
the table will be referred to by this namefieldNames - User specified names for the fields of
the table. In other commands, fields will be referred to by
these names.src - The NetricsRecSrc object which holds the records for this
table (can be null to create an empty table)public NetricsTable(java.lang.String name,
java.lang.Boolean is_parent,
java.lang.String[] fieldNames,
NetricsRecSrc src)
name - The name of the table. Must be unique. In other commands,
the table will be referred to by this nameis_parent - If true this table is created as a parent table.fieldNames - User specified names for the fields of
the table. In other commands, fields will be referred to by
these names.src - The NetricsRecSrc object which holds the records for this
table (can be null to create an empty table)public NetricsTable(java.lang.String name,
java.lang.String parent_tbl,
java.lang.String[] fieldNames,
NetricsRecSrc src)
name - The name of the table. Must be unique. In other commands,
the table will be referred to by this name.parent_tbl - Name of the parent of this table. If present the
the named table must exist and be a parent table,
this table is created as a child table,
otherwise it is created as a standard table.fieldNames - User specified names for the fields of
the table. In other commands, fields will be referred to by
these namessrc - The NetricsRecSrc object which holds the records for this
table (can be null to create an empty table)public void setGpuIndexing(java.lang.Boolean enabled)
enabled - True: Enable GPU-accelerated indexing.Attempting to enable GPU acceleration when the server does not support it will result in a FEATURESET error.
public void setGpuDevices(int[] device_ids)
Attempting to select GPU devices when the server does not support GPU acceleration will result in a FEATURESET error.
The device ids must be values returned by TIB_patterns -C LIST.
device_ids - The GPU devices to use. Pass null or an empty array
to use the server default.public java.lang.String getString()
public NetricsRecSrc getRecSrc()
The returned NetricsRecSrc object can be used to retrieve all of the records of the table.
NetricsServerInterface.tbldump(java.lang.String, com.netrics.likeit.NetricsLock)public java.lang.String getName()
public void setEstNumRecords(int est_num)
est_num - the estimated number of recordspublic void setGipGramLen(int glen)
glen - the GIP gram length.public void setInfo(java.lang.String info)
info - a string associated with the table.NetricsServerInterface.list(java.lang.String[])public java.lang.String getInfo()
NetricsServerInterface.tbldump(java.lang.String, com.netrics.likeit.NetricsLock)public void setFieldTypes(int[] ftypes)
Valid field types:
| Field Type | Description |
| NetricsTable.FLDTYP_TEXT | Non-searchable text |
| NetricsTable.FLDTYP_SRCHTEXT | Searchable text |
| NetricsTable.FLDTYP_INT | Integer type field |
| NetricsTable.FLDTYP_FLOAT | Float type field |
| NetricsTable.FLDTYP_DATE | Date type field (default format: yyyy/mm/dd) |
| NetricsTable.FLDTYP_DATETIME | Date type field, with time (default format: yyyy/mm/dd HH:MM:SS) |
| NetricsTable.FLDTYP_ATTRS | Name/Value attributes type field |
ftypes - the array of field types. The length of the array
must be the same as the number of fields in the table.public void setGipFiltered(boolean enabled)
If enabled is set to true the created table will use the GIP prefilter. If set to false the GIP prefilter is not used.
A TIBCO Patterns server has a default prefilter for all tables created on the server. This is normally the GIP prefilter, but can be set to one of the other prefilters when the server is started (see the installation guide). When a table is created the prefilter to use can be specified explicitly using the setGipFiltered, setSortFiltered, and setPsiFiltered methods. Only one of these methods can be set true for particular table. To create a table with no prefilter all methods should be set false.
For a table of any significant size it is strongly recommended that a prefilter be used. Without a prefilter query times on even relatively small tables will be excessive. For more information on prefilters see the TIBCO Patterns Concept Guide.
enabled - if true use the GIP prefilter, if false do not use
the GIP prefilter.setSortFiltered(boolean),
setPsiFiltered(boolean)public boolean isGipFiltered()
public void setSortFiltered(boolean enabled)
If enabled is set to true the created table will use the SORT prefilter. If set to false the SORT prefilter is not used.
A TIBCO Patterns server has a default prefilter for all tables created on the server. This is normally the GIP prefilter, but can be set to one of the other prefilters when the server is started (see the installation guide). When a table is created the prefilter to use can be specified explicitly using the setGipFiltered, setSortFiltered, and setPsiFiltered methods. Only one of these methods can be set true for particular table. To create a table with no prefilter all methods should be set false.
For a table of any significant size it is strongly recommended that a prefilter be used. Without a prefilter query times on even relatively small tables will be excessive. For more information on prefilters see the TIBCO Patterns Concept Guide.
enabled - if true use the SORT prefilter, if false do not use
the SORT prefilter.setGipFiltered(boolean),
setPsiFiltered(boolean)public boolean isSortFiltered()
@Deprecated
public void setSortEncodings(java.lang.String[][] encodings,
int[][] backwards_fields)
throws NetricsException
encodings - Each string array is a list of field names which will
be used for a given sort encoding. The first field name will be the
primary sort key, the second field will be secondary, and so on. In
general, you should have as many encodings as the number of fields
in the table and use all important fields as the primary sort key
in at least one encoding.backwards_fields - Fields can also be sorted backwards (from
the last characters in the field to the first). Important fields can
and should be used as primary sort keys in both their forward and
reverse directions. The backwards_fields array should be the same
length as the encodings array and the subarray at each position
in the two primary arrays should also be the same length. In this way,
there is an integer in the backwards_fields arrays for each of the
fields in the encodings arrays. The integer is set to 1 if the field
is to be sorted in the backwards direction and zero for the forward
direction.NetricsException - if the arrays are of improper lengths.public void setSortEncodings(NetricsSortEncoding... encodings)
encodings - The encodings to use. In general, you should have
as many encodings as the number of fields in the table and use all
important fields as the primary sort key in at least one encoding.@Deprecated
public void setPsiEncodings(java.lang.String[][] encodings,
int[][] backwards_fields,
int[] suffixed_fields,
int[][] min_match_sizes)
throws NetricsException
encodings - Each string array is a list of field names which will
be used for a given PSI encoding. The first field name will be the
primary PSI key, the second field will be secondary, and so on. In
general, you should have as many encodings as the number of fields
in the table and use all important fields as the primary PSI key
in at least one encoding.backwards_fields - Fields can also be sorted backwards (from
the last characters in the field to the first). Important fields can
and should be used as primary PSI keys in both their forward and
reverse directions. The backwards_fields array should be the same
length as the encodings array and the subarray at each position
in the two primary arrays should also be the same length. In this way,
there is an integer in the backwards_fields arrays for each of the
fields in the encodings arrays. The integer is set to 1 if the field
is to be sorted in the backwards direction and one for the forward
direction.suffixed_fields - Indicates the number of fields in each encoding
to which suffixing is applied. Currently PSI only supports suffixing
the first field, so the entries of this array must be 0 or 1.min_match_sizes - Indicates the minimum match size for each field
of each encoding. Match sizes are in characters for text fields, and
in bytes for non-text fields. A candidate record is rejected if none
of the minima are met. Like backwards_fields this array must have the
same dimensions as encodings.NetricsException - if the arrays are of improper lengths.setPsiEncodings(String[][], int[][], int[], int[][], Integer[])public void setPsiFiltered(boolean enabled)
If enabled is set to true the created table will use the PSI prefilter. If set to false the PSI prefilter is not used.
A TIBCO Patterns server has a default prefilter for all tables created on the server. This is normally the GIP prefilter, but can be set to one of the other prefilters when the server is started (see the installation guide). When a table is created the prefilter to use can be specified explicitly using the setGipFiltered, setSortFiltered, and setPsiFiltered methods. Only one of these methods can be set true for particular table. To create a table with no prefilter all methods should be set false.
For a table of any significant size it is strongly recommended that a prefilter be used. Without a prefilter query times on even relatively small tables will be excessive. For more information on prefilters see the TIBCO Patterns Concept Guide.
enabled - if true use the PSI prefilter, if false do not use
the PSI prefilter.setSortFiltered(boolean),
setGipFiltered(boolean)public boolean isPsiFiltered()
@Deprecated
public void setPsiEncodings(java.lang.String[][] encodings,
int[][] backwards_fields,
int[] suffixed_fields,
int[][] min_match_sizes,
java.lang.Integer[] densities)
throws NetricsException
encodings - Each string array is a list of field names which will
be used for a given PSI encoding. The first field name will be the
primary PSI key, the second field will be secondary, and so on. In
general, you should have as many encodings as the number of fields
in the table and use all important fields as the primary PSI key
in at least one encoding.backwards_fields - Fields can also be sorted backwards (from
the last characters in the field to the first). Important fields can
and should be used as primary PSI keys in both their forward and
reverse directions. The backwards_fields array should be the same
length as the encodings array and the subarray at each position
in the two primary arrays should also be the same length. In this way,
there is an integer in the backwards_fields arrays for each of the
fields in the encodings arrays. The integer is set to 1 if the field
is to be sorted in the backwards direction and one for the forward
direction.suffixed_fields - Indicates the number of fields in each encoding
to which suffixing is applied. Currently PSI only supports suffixing
the first field, so the entries of this array must be 0 or 1.min_match_sizes - Indicates the minimum match size for each field
of each encoding. Match sizes are in characters for text fields, and
in bytes for non-text fields. A candidate record is rejected if none
of the minima are met. Like backwards_fields this array must have the
same dimensions as encodings.densities - Indicates the suffix-density of each encoding. Each
entry should be one of NetricsTable.PSI_DENSITY_DENSE,
NetricsTable.PSI_DENSITY_STANDARD, NetricsTable.PSI_DENSITY_SPARSE, or
null to use the default.NetricsException - if the arrays are of incorrect lengths.public void setPsiEncodings(NetricsPsiEncoding... encodings)
encodings - The encodings to use. In general, you should have
at least as many encodings as the number of fields in the table and use
all important fields as the primary sort key in at least one encoding.public void addPIndex(java.lang.String field_name,
boolean primary,
java.lang.String[] partition_separators,
boolean normalized)
Partition indexes may be defined as either Primary or Secondary. Primary indexes give a much better performance improvement, especially on large tables and with highly selective predicates, but at a cost of significantly larger memory requirements and slightly slower load times. The additional memory overhead for a primary index is much larger if more than one primary index is defined for a table.
If you are using filtering predicates properly defined partitioned indexes in conjunction with a properly formulated predicate expression can dramatically improve performance on large tables. It is recommended that you consult with your TIBCO representative to determine the optimal use of partition indexes for your particular situation.
field_name - The name of the field that is to be indexed.primary - If true this is a primary index, otherwise it is a
secondary index.partition_separators - This is an array that defines the upper
bound of each partition. The values MUST
be in sorted order (as per the type of the named field)
least to greatest. The size of the array defines the
number of partitions.normalized - If true and the field is a string value the
normalized values are indexed. Thus this index
will work with the case insensitive comparison
operators and not work with the standard operators.NetricsPredicate,
NetricsSearchCfg.SetSearchPredicate(com.netrics.likeit.NetricsPredicate)public void setPhonetic(boolean enabled)
enabled - Must be false.public void setPsiDensity(int density)
density - One of NetricsTable.PSI_DENSITY_DENSE,
NetricsTable.PSI_DENSITY_STANDARD, NetricsTable.PSI_DENSITY_SPARSE.public java.lang.String[] getFieldNames()
NetricsServerInterface.tbldump(java.lang.String, com.netrics.likeit.NetricsLock)public void setCharmaps(java.lang.String[] charmaps)
The length of this array must be the same as the number of fields in the table. This is a list of the names of character maps assigned to each field. Entries that do not correspond to fields of type FLDTYP_SRCHTEXT are ignored.
There are two predefined character maps:
NetricsCharmap.Standard - the default character map.
NetricsCharmap.Punctuation - a punctuation sensitive map.
DEFAULT: if not specified all searchable fields use the predefined character map: NetricsCharmap.Standard
charmaps - A string name of the character map to use for each field in the table.NetricsCharmap,
NetricsServerInterface.cmapcreate(com.netrics.likeit.NetricsCharmap)public java.lang.String compare(NetricsTable tbl)
tbl - table to compare to.