Open topic with navigation

TIBCO® Patterns 6.1.2

# Simple Queries

A query consists of a fixed data item that one wants to compare with a set of items or records in some collection of data. A query might be a single, unstructured, text string such as the interactive queries that a user types into a search box. It can also be a structured item similar to the fielded records themselves. The parts of a structured query are usually targeted against the corresponding fields of the records. (Consider the “advanced search” function often provided by many search engines.)

An unstructured query consisting of a single text string is called a simple query. With TIBCO Patterns, you can compare a simple query against any or all of the searchable-text attributes of a table.

Note: Here, the term "attribute" refers to a searchable element of the record. It might be a field of the record or it might be a named Variable Attribute.

For each record, the TIBCO Patterns matching algorithm finds the best match across the selected attributes. The resulting match score – a value between 0.0 and 1.0 – reflects the contributions of the whole or partial matches found in each field. You can also apply "weighting" to adjust the score contributions made by the material matched in the specific fields.

For example, suppose an online bookseller provides a catalog search based on three fields: Author, Book Title, and Book Description. By default, a simple, unstructured query against these three fields weight match contributions equally from any of the three. But you would likely consider content matched in the first two fields to be more significant than content matched in the third field. Therefore, retain the default field weight of 1.0 for the first two fields, and assign a lower weight such as 0.8 to the Book Description field. (Field weights, like the match score, are floating point values between 0.0 and 1.0).

Query matching is performed first, uninfluenced by weighting factors. After a matching is complete, the weighting factors are applied in computing the final score.

Consider the following additional points when weighting simple query comparisons against multiple fields:

| • | Lowering the weight of a field from the default value of 1.0 reduces the score of records with matches in that field, even if they are perfect matches.

All else being equal matches in lower weighted fields will receive lower scores than the same match in a higher weighted field. In general, the highest score a match into a particular field can receive is the field weight for that field.

In terms of our example, a simple query that perfectly matched a phrase in the `Book Description` field would receive a lesser score for that record than for another record in which it perfectly matched the `Book Title`.

| • | A set of weights that appear right for one particular query might not be right for other queries with different data or structures. Hence, when adjusting the field weights, be sure to test the selected set of weights using a variety of queries.

| • | If a query string is empty, or if all the values to be searched are empty, there is no information on which to base a match score. In this case, the query is assigned the "empty score". The empty score defaults to 0.0, but you might set this to any value between 0.0 and 1.0. In the vast majority of cases, 0.0 is the appropriate empty score, but in some cases it might be more appropriate to set this to some intermediate value. Consider a case when querying against a Variable Attribute where records might or might not contain that attribute. You might not want to penalize records that do not contain the attribute (see the sections on AND score combiner and Attributes queries for other means of dealing with missing data). Using a special score you can reject a record entirely when the "empty" condition is encountered. This is quite different than a zero score, especially when complex queries are used. It is possible that a record with a zero score might be returned, if enough records with non-zero scores are not available to fill the requested return set size, and if this is part of a complex query, the final score might be quite high even if this component of the complex query has a zero score. However, if the special reject score is used (in the AND combiner) the record is not returned.

A couple of other options are available with simple queries that are described in detail in later sections:

| • | You can define a thesaurus to be used for a particular simple query, even if the simple query is just one part of a more complex query structure. See the section Complex Queries for details on complex queries.

| • | Similarly, you can define the scoring mode (such as normal or symmetric) to be used for a particular simple query, even if the simple query is just one part of a more complex query structure.

| • | You can query on specific attributes in a Variable Attributes type field. See Variable Attributes Queries for details.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Patterns

Copyright © 2010-2025. Cloud Software Group, Inc. All Rights Reserved.