Loading...

Make the plot searchable

Your movies list works, but only if a visitor types the exact title. Real people search for what they remember: "the one about dreams". This step fixes that.

What a searchable field is

A searchable field is any text you want search to look inside. Every list starts with one, name, which is why title search already works. Add more searchable fields and search looks across all of them at once, matching and ranking on every word. For movies, the obvious one is the plot: add it, and "dreams" finds Inception even though that word isn't in the title.

Add the plot field

Open the movies list, choose Fields, then Add Searchable Field.

The Fields menu open, showing Add Searchable Field

Name it plot and add it. That's the whole change. The field is live immediately.

The Add Searchable Field dialog with the name 'plot'

Adding a field doesn't disturb anything you already have. Your existing films are still there; they just have an empty plot until you fill it in. (Because adding a field is safe like this, it does not create a new API version — there's a step on that later.)

Fill in the plots

Open a film with Edit and you'll see the new plot box. Add a sentence describing the film and save.

Editing Inception to add its plot text

Do that for a few films and the list shows the plot alongside each name:

The movies list now showing a populated plot column

Search across both fields

Search now looks in the name and the plot together. A visitor typing dream finds Inception through its plot, even though the word isn't in the title:

GET https://api.searchstack.dev/search/Demo/movies/1?query=dream
X-API-Key: {your key}

The custom fields you added ride along in each result under fields:

{
  "results": [
    {
      "name": "Inception",
      "fields": {
        "plot": "A thief who enters people's dreams to steal secrets is hired to plant an idea instead."
      }
    }
  ],
  "count": 1,
  "total_count": 1
}

Add as many searchable fields as make sense for your data: a tagline, a director, a list of actors. Everything you make searchable becomes another way for a visitor to find the right film.

Go deeper: Fields in the reference.

Top