# Full Text Search

Full-text search is a specialised **search technique** that allows users to search for text within large amounts of textual data and **retrieve relevant documents** or records that contain the queried words or phrases.&#x20;

Full-text search enables users to find relevant information even if the search terms are not an exact match.

While traditional databases can handle some text-based searching using techniques like wildcard or pattern matching, they are not optimised for efficient full-text search across extensive text data.

## Understanding full-text search using a example

Imagine a library database with a collection of book records. Each record includes details such as the book's title, author, genre, and a brief description. Here's a simplified representation:

```javascript
{
  "books": [
    {
      "title": "The Catcher in the Rye",
      "author": "J.D. Salinger",
      "genre": "Fiction",
      "description": "A classic novel about teenage angst."
    },
    {
      "title": "To Kill a Mockingbird",
      "author": "Harper Lee",
      "genre": "Fiction",
      "description": "A poignant tale of racial injustice in the American South."
    },
    {
      "title": "The Great Gatsby",
      "author": "F. Scott Fitzgerald",
      "genre": "Fiction",
      "description": "A vivid portrayal of the American Dream in the 1920s."
    }
  ]
}

```

### **Performing Full-Text Search**

Now, let's say we want to find all books that discuss the theme of "American Dream." A traditional search might struggle with this task.

However, with full-text search capabilities we will receive result as :&#x20;

**Search Query:** "American Dream"

```javascript
{
  "results": [
    {
      "title": "The Great Gatsby",
      "author": "F. Scott Fitzgerald",
      "genre": "Fiction",
      "description": "A vivid portrayal of the American Dream in the 1920s."
    }
  ]
}

```

## Understand full-text search in detail

* [<mark style="color:blue;">**How does indexing work in full-text search ?**</mark>](https://docs.cosmocloud.io/resources/document-search/full-text-search/concepts/indexing-in-full-text-search)
* [<mark style="color:blue;">**How data is processed using Analyzers ?**</mark> ](https://docs.cosmocloud.io/resources/document-search/full-text-search/concepts/data-processing-using-analyzers)
