Following appropriate preparations, full text searches can be performed in a number of ways.
Before attempting a full text search, you must:
Ensure that Couchbase Server has the Search service appropriately enabled. The service must be enabled for a given node as part of that node’s configuration. Refer to Create a Cluster for information.
Create an appropriate index. This can be accomplished by means of the Couchbase Web Console. For a simple example of index creation, which allows you to get started quickly, refer to Searching from the UI. For a more detailed explanation of the available options, including index creation by means of the Couchbase REST API, refer to Creating Indexes.
Note that during index creation, in support of most query-types, you can select (or create) and use an analyzer. This is optional: if you do not specify an analyzer, a default analyzer is provided. Analyzers can be created by means of the Couchbase Web Console, during index creation, as described in Creating Indexes. Their functionality and inner components are described in detail in Understanding Analyzers.
Full text searches can be performed with:
The Couchbase Web Console. This UI can also be used to create indexes and analyzers. Refer to Searching from the UI for information.
The Couchbase SDK. This supports several languages, and allows full text searches to be performed with each. Refer to the SDK’s java-sdk::full-text-search-overview.adoc page for information. Note also that the java-sdk::full-text-searching-with-sdk.adoc page for the Java SDK provides an extensive code-example that demonstrates multiple options for performing full text searches. (Refer to Establishing Demonstration Indexes below for more information.)
The N1QL Search functions. These enable you to perform a full text search as part of a N1QL query. Refer to Search Functions for information.
The Java SDK code-example provided in java-sdk::full-text-searching-with-sdk.adoc contains multiple demonstration calls — each featuring a different query-combination — and makes use of three different index-definitions, related to the
travel-sample bucket: for the code example to run successfully, the three indexes must be appropriately pre-established.
The definitions are provided in Demonstration Indexes.
Instructions on how to use the Couchbase REST API to establish the definitions are provided in the section Index-Creation with the REST API, on the page Creating Indexes.