Full Text Searching can provide robust search capabilities on columns that have a Full Text Index. You are able to use the predicates CONTAINS and FREETEXT for this purpose.
In order to perform a Full Text Search, each column in your query will need a Full Text Index.
Full Text Searching is currently only available for those using SQL Server 2016 or up.
CONTAINS is a predicate used in the WHERE clause of a CQL SELECT statement to perform full-text search on full-text indexed columns containing character-based data types.
CONTAINS can search for:
A word or phrase.
The prefix of a word or phrase.
A word near another word.
A word inflectionally generated from another (for example, the word drive is the inflectional stem of drives, drove, driving, and driven).
Using this general syntax without any modifiers, your results will return the specific rows that match the exact word or phrase specified between the single quotes in line 2.
In the following example, we want to return all rows from the Cinchy Wiki Documentation table (in the Product domain) that match the exact word overview in their Title column.
There are many modifiers you can add to your CONTAINS full text search query to receive more specific results.
Using a prefix term modifier will return results with your specified prefix. For example, the prefix 'over' could return overview, overture, overruled, etc.
To use a prefix term, wrap your term in single, then double quotes and put an asterix at the end: '"example*"'
In this example, we have modified our search so that we receive all results where the any word in the Title column contains the prefix 'over'.
A generation term modifier searches for all the different tenses and conjugations of a verb or both the singular and plural forms of a noun (an inflectional search) or for synonymous forms of a specific word (a thesaurus search).
In order to return the synonymous forms, you must have a Thesaurus file configured. Find more information here.
In this example, our query will return all results with different tense and conjugations of our search word, 'gave'.
In this example, we want to return all results where the data in the Summary column matches the meaning of our search term.
I.E. "install" might return results with "deploy", "configure", "set", etc.
A proximity term will return words or phrases that are near to each other. You can also specify the maximum number of non-search terms that separate the first and last search terms.
Note that proximity terms in Cinchy do not adhere to the specified order written in the query. You will receive results of both "term 1+term 2" as well as "term 2+term 1".
This example returns all results where the terms "first" and "page" appear within two words of each other.
With CONTAINS, you can use AND, OR, and AND NOT to specify your results.
In this example, we want search results from the Summary column of the Cinchy Wiki Documentation page that contain both the word 'user' and the word 'page'.
In this example, we want search results from the Summary column of the Cinchy Wiki Documentation page that contain either the word 'user' or the word 'page'.
In this example, we want search results from the Summary column of the Cinchy Wiki Documentation page that contain the word 'user' and not the word 'page'.
You can use this modifier to return results with terms that appear near each other (i.e. within the same data cell).
In this example, we want to return all results where the data in the Title column has the term "data" appearing near the term "CinchyDXD".
The FREETEXT command provides the ability to search for a matched term based on the meaning of the terms as opposed to the exact character string.
At a high level, this commands finds matches based on separating the string into individual words, determining inflectional versions of the word and using a thesaurus to expand or replace the term to improve the search.
The difference between FREETEXT and CONTAINS is that it searches for the values that match the meaning of a phrase and not just exact words. It is therefore a better option if you are searching phrases, in lieu of individual words.
In order to use FREETEXT, you must have a Thesaurus file configured. Find more information here.
In this example, we want to return all results where the data in the Summary column matches the meaning of our search phrase.
I.E. "installation guide" might return results with "deployment instructions", "set up guide", etc.