An exact phrase search returns only phrases that contain
all the words in the clue in the exact order that you specify.
To execute an exact phrase search, you set the SEARCH_TYPE tuning
parameter to
PHRASE_EXACT, as shown in the following
example:
SELECT id, description FROM videos
WHERE etx_contains(description,
Row ('multimedia document editor','SEARCH_TYPE = PHRASE_EXACT'));
The following figure displays the resulting hitlist when the query
in the example is run on the
videos table. Since an exact phrase
search with no pattern matching is specified, the document that contains
the phrase
mulitmedia document editor (
mulitmedia intentionally
misspelled) is not returned.
Figure 1. Example of exact phrase search
An exact phrase search for a clue that contains a stopword returns
zero rows, even if the clue is contained in a document. This happens
only if the etx index ignores stopwords, or in other words,
if the index was created with the STOPWORD_LIST index parameter and
the stopword list contains one or more words in the clue.
For example, assume that the etx index was created with
the index parameter STOPWORD_LIST = 'my_list', and
that the stopword list my_list includes the word the.
In this case, an exact phrase search for the clue “walk the dog” returns
zero rows, even if this exact phrase is contained in a document.
There are two ways to work around this behavior:
- Use an approximate phrase search instead of an exact phrase search.
Approximate phrase searches, however, can be slower than exact phrase
searches.
- Include stopwords in the etx index by specifying the INCLUDE_STOPWORDS
index parameter when you create the index. Then specify that stopwords
must be considered when executing an exact phrase search for the phrase
“walk the dog” by specifying the CONSIDER_STOPWORDS and SEARCH = PHRASE_EXACT
tuning parameters in the etx_contains() operator.