Full-text search

Most apps allow users to search app content. For example, you may want to search for posts containing a certain word or notes you've written about a specific topic.

Cloud Firestore doesn't support native indexing or search for text fields in documents. Additionally, downloading an entire collection to search for fields client-side isn't practical.

To enable full text search of your Cloud Firestore data, use a dedicated third-party search service. These services provide advanced indexing and search capabilities far beyond what any simple database query can offer.

Before continuing, research then choose one of the search providers below:

Solution: External search service

Consider a note-taking app where each note is a document:

// /notes/${ID}
{
  owner: "{UID}", // Firebase Authentication's User ID of note owner
  text: "This is my first note!"
}

Before indexing a document with Typesense, create a Typesense collection. You can create a collection using either the Typesense API or the Typesense console:

You can use Typesense with Cloud Functions to populate an index with the contents of each note and enable search.

It's not necessary to fetch a search key for every query. You should cache the fetched key, or the Typesense client, to speed up searching.

Limitations

  • Pricing: Typesense offers many service tiers, make sure to visit the pricing page and choose the option that best fits your needs.