Relevance Ranking Using LIKER and LIKEP

In addition to the Metamorph searches listed above there is another type of search based on Metamorph. This will return rows in order of relevance, with the most relevant record first (unless other clauses alter this order, e.g. an ORDER BY). LIKER calculates a relevance based solely on the presence or absence of the terms in the document. LIKEP uses this same information, but also uses the proximity of the terms to calculate relevance.

There are several restrictions and points to note about LIKER and LIKEP. The conditions that must be met to obtain a relevancy search are that a Metamorph index exists on the field in question. LIKER can only work with an index; while LIKEP can work without such an index, it performs best with one. The other condition is that the query should consist of word terms only. None of the other pattern matchers are available with LIKER; they are available with LIKEP, but at a cost in performance (post-processing is required).

The query is a list of terms to be searched for. The words are weighted by their uniqueness in the document set being searched. This means that infrequent words are weighted more than common words.

The weight that was calculated for the record is available by selecting the generated field $rank, which will contain the rank value. The rank value for LIKER is unscaled. With LIKEP the number will range between 0 and 1000, where greater values indicate greater computed relevance to the query.

The default ordering of LIKER and LIKEP (rank-descending) may be changed by an ORDER BY clause. Historically (prior to Texis version 8), an ORDER BY containing $rank (or potentially any expression containing $rank) would usually order descending as well - despite the typical default ORDER BY order being ascending - because rank-descending is considered more useful (and often low-rank results are eliminated prior to ordering anyway). However, this caused confusion when giving the DESC flag, as then ORDER BY $rank DESC would return ascending results.

Thus, in Texis version 8 and later, ORDER BY clauses containing $rank will order consistently with other ORDER BY clauses - i.e. numerically ascending unless the DESC flag is given. This means that in version 8 and later, most ORDER BY $rank clauses should probably be ORDER BY $rank DESC, to get rank-descending behavior. This behavior may be altered by the legacyversion7orderbyrank SQL setting (here).

For fuller details on using the logic operators in LIKE see Chapter here

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.