Non-fuzzy Search Over a TEXT Index

Non-fuzzy search on NGRAM breaks the term into corresponding n-grams and searches for the n-grams in the NGRAM TEXT index.

The query CONTAINS ( M.Description, 'ams' ) ct; illustrates a non-fuzzy NGRAM search over a 2GRAM index, which is semantically equal to searching query CONTAINS( M.Description, '"am ms"' ) ct;

If you search for a ‘v*’ TERM on a 2GRAM index, then v followed by any alphabet is considered as a matching 2GRAM for the searching term and is output as a result.

The query CONTAINS (M.Description, ‘white whale’) ct; illustrates a non-fuzzy NGRAM search over a 3GRAM index and is semantically equal to searching query CONTAINS (M.Description, ‘”whi hit ite wha hal ale”’);

The difference between NGRAM fuzzy and non-fuzzy search is that fuzzy search is a disjunction over individual GRAMS. Non-fuzzy search is a conjunction over the individual GRAMS. When GENERIC and NGRAM TEXT indexes are created on the same column, then the GENERIC TEXT index is used for a query with non-fuzzy search and the NGRAM TEXT index is used for fuzzy search.

Example 1: non-fuzzy search after creating a GENERIC TEXT index on the same column

This query illustrates non-fuzzy search after creating a GENERIC TEXT index on the same column:

SELECT * FROM t_iq WHERE CONTAINS (b,'bookworm');

The results of the query are:

a         b       
5         he is a bookworm

Example 2: fuzzy search with both NGRAM and GENERIC TEXT indexes on the same column

This query illustrates fuzzy search with both NGRAM and GENERIC TEXT indexes on the same column:

SELECT * FROM t_iq 
WHERE CONTAINS (b,’FUZZY “bookwerm”’);

The results of the query are:

a         b       
2         book he ookw worm okwo kwor
5         he is a bookworm
6         boo ook okw kwo wor orm

Example 3: fuzzy search phrase in a non-fuzzy search clause

This query illustrates the behavior of a fuzzy search phrase in a non-fuzzy search clause:

SELECT * FROM t_iq WHERE CONTAINS (b,’bookwerm’);

No result is returned for this query.