Phrase searching with pattern matching
When you perform a search with SEARCH_TYPE = PHRASE_EXACT
,
the search text must contain a phrase that is identical to the clue
for a hit to occur. If you specify a pattern search in addition to
an exact phrase search (by specifying PATTERN_ALL, for example), the
individual words in the clue must pattern-match the corresponding
words in the search text in the same order in which the words appear
in the search text.
For example, in a pattern search combined with an exact phrase
search, the text jill
john
jones
matches
the clue jyll
jonh
gones
but
does not match the clue john
jill
jones
.
That is, order always counts in an exact phrase search, regardless
of whether you also specify pattern matching.
In an exact phrase search, all words in the clue (or pattern matches thereof) must be found in the search text. Partial matches, where one or more words are missing, do not count as hits.
When you perform a search with SEARCH_TYPE = PHRASE_APPROX
,
the search text must contain either a phrase identical to the clue,
one or more words of the clue in the same order, or one or more words
of the clue in a different order. The module
uses the number of words and word order to produce a document score
for all hits; the more words in closer order a search text has, the
higher the score it is assigned.
He can drop many balls (exact match)
He has many balls (2 words, in same order as clue)
He let five balls drop (2 words, different order from clue)
He has many children (1 word)
SEARCH_TYPE
= PHRASE_APPROX
. However, a pattern search adds pattern matching
on a word-by-word basis. For example, if the clue is “drop many
balls,” then the search engine produces the following ranking: He can dorp many valls (assuming dorp pattern matches drop,
and so on)
He has mani balds
He let five galls frop
He has many children
SELECT * FROM videos
WHERE etx_contains(description,
Row('multimedia' , 'PATTERN_TRANS & PATTERN_SUBS')) ;
multimedia
clue.
The search engine returns all words that have exactly one substitution
or one transposition, as well as words that match the clue exactly.
The following figure displays the resulting hitlist when the query
in the example is run on the videos table.The tuning parameters PATTERN_TRANS and PATTERN_SUBS only take into account the transposition or substitution of a single letter per word.