LIKE

This operator is meant to be used in application development environments. It searches for documents that are similar to the sample one or more documents or text passages you provide. The search engine analyzes the provided text to find the most important terms to use for the search. If multiple samples are provided, the search engine assumes that all of the samples are about a single theme and selects important terms common across the samples. Retrieved documents are relevance-ranked.

The LIKE operator accepts a single operand, called the QBE (query-by-example) specification. The QBE specification can be either the literal text of the example to query on, or it can be a specification of one or more full documents and text passages to use as positive and negative examples.

Please note: In the case where a query or document contains only words defined as stop words in the collections style.stp file(s), a QBE query with the LIKE operator returns no results.

Syntax

Document specification is made with a series of text references enclosed in braces. The syntax for specifying references is:

{[name=]type:value [name=]type:value ...}

where:

  • name is either posex ("positive example"), or negex ("negative example"). A negative example reduces the weights of terms when they occur in a positive example. If terms from a negative example do not exist within the positive example, the negative example has no effect. (Hence a negex by itself makes no sense.) The variable name is optional. If not specified, name is set internally to posex. In this case the equal sign must neither be present.
  • type can be one of the following:
    • VdkVgwKey, to specify a document by its external ID, i. e. the content ID in the Content Manager or the object ID in the Template Engine.
    • Text, to specify the text directly
  • value is a reference to a piece of text to use as the positive or negative example. The value of value depends on type.
    • VdkVgwKey: the document ID (i. e. content or object ID)
    • Text: Literal text.

If there is no explicit type specifier, value is interpreted in the following ways:

  • Literal text if it starts with a quotation mark
  • VdkVgwKey for all other cases

The LIKE operator can be combined with other operators using the same rules as for the ACCRUE operator.

Examples

The following examples illustrate uses of the LIKE operator. Integer numbers always represent a content or an object ID.

Just literal text:

<LIKE> ("The dog ate the shoe.")

Explicit specification of a single positive example:

<LIKE> ( "{posex=vdkvgwkey:650431}" )

Explicit specification of multiple positive and negative examples:

<LIKE> ( "{posex=vdkdocid:7369 posex=vdkvgwkey:8457
negex=text:"stock market"}" )

Same as the preceding but with implied reference types:

<LIKE> ( "{posex=#7369 posex=8457 negex=\"stock market\"}" )

Similar to the preceding but with implied posex names:

<LIKE> ( "{vdkdocid:7369 vdkvgwkey:8457}" )

Same as the preceding, but using the most implicit syntax:

<LIKE> ( "{#7369 8457}" )

You can combine a text reference list with literal text:

<LIKE> ( "{#7369 8457} And more text" )

The preceding QBE specification is equivalent to this:

<LIKE> ( "{#7369 8457 text: \"And more text\"}" )

The simplest way of specifying a single positive example by VgwKey:

<LIKE> ( "{650431}" )

The example is in the file doc.txt, starting at the 100th byte:

<LIKE> ( "{posex=file:doc.txt:100:200}" )

Quotation marks embedded in LIKE expressions must be preceded by backslashes. The backslash indicates to the engine that the following character is supposed to be treated as a literal character.

Efficiency Considerations

In order to process a LIKE expression, the search engine must analyze the full text of the examples in the QBE specification. This may be time consuming, especially if the example documents are large or require extensive filtering.