Search is here! Convex’s full text search makes adding search to your app a breeze.

Search queries, like standard database queries, are automatically reactive, consistent, transactional, and work seamlessly with pagination.

The full list of features in this releases is:

  • Full Text Search (BETA)
  • Open Source Python Client

Details below. Let us know what you think in Discord!

Full Text Search (BETA)

Full text search allows you to find Convex documents that match keywords.

Unlike normal database queries, search queries look within a string field to find the keywords. This can be used to build search features within your app like searching for messages that contain a set of words.

To use full text search, first add a search index to your schema in convex/schema.ts:

import { defineSchema, defineTable, s } from "convex/schema";

export default defineSchema({
  messages: defineTable({
    body: s.string(),
  }).searchIndex("search_body", {
    searchField: "body",
  }),
});
convex/schema.ts

Then, you can query this index to find matching documents:

const messages = await db
  .query("messages")
  .withSearchIndex("search_body", q => q.search("body", "hello hi"))
  .collect();

This query tells Convex to find documents in the messages table where the body field contains the words "hello", "hi", or both.

Convex search queries are consistent and transactional, meaning a search query is never stale and always represents the latest state of the database. You can even run a search query in the middle of a mutation and observe the latest transaction state, just like regular database read operations!

To learn more about full text search, check out the docs.

Full text search is a beta feature. If you have feedback or feature requests, let us know in Discord!

Open Source Python Client

We’ve open sourced the Convex Python client! You can see the full source at https://github.com/get-convex/convex-py. Now accepting PRs.