TIBCO Patterns Queries
A TIBCO Patterns query performs a fuzzy search for records that are most similar to the query string. A TIBCO Patterns query does not return a specific set of records that meet a specific set of criteria, instead it returns a set of records that are judged to be most similar to the specified query. A TIBCO Patterns query is not an SQL query with a few new operators; its behavior is fundamentally different. An SQL query has a specific set of records that meet the conditions defined by the query. For a TIBCO Patterns query no specific set of records are specified, all records match the query, the only difference lies in the degree of similarity.
When designing a TIBCO Patterns query one should always keep in mind that the purpose of the query is to provide enough information to allow TIBCO Patterns to distinguish the records you want to see from those you do not. A common mistake made when designing a TIBCO Patterns query is to translate a set of SQL queries directly into what appears to be the corresponding TIBCO Patterns constructs. These SQL queries were developed to get around the lack of fuzzy matching in SQL by doing a series of queries and merging the results using a set of coded rules. This type of direct translation has two major issues:
| 1. | Each of the separate SQL queries probably provides too little information for TIBCO Patterns to make a reasonable selection. A query on just a person's name, followed by a query on just a street address, and then a merge of common records in the returned lists is far less likely to yield the results you want than a single query on both name and address. |
| 2. | Issuing multiple queries is far less efficient than issuing a single query with more data. A fuzzy search is generally more expensive than an SQL exact match search. A single well designed TIBCO Patterns query, however, can often replace a whole set of SQL searches and give better results, making it more efficient overall. |
As a general rule, one should attempt to use a single query that contains all of the available data, rather than two or more queries that contain subsets of the data available.
Although the TIBCO Patterns query API provides exact matching capabilities via the predicate query type, all queries performed by TIBCO Patterns are fuzzy queries, and therefore must contain fuzzy matching data. A query that consists only of exact match predicate queries is not allowed. Obvious cases are rejected by the server. Although it is possible to circumvent the query structure validations through various means, a query that is effectively based only on a predicate query does not return the desired results. TIBCO Patterns is a fuzzy matching engine.