Happy Holidays folks! We wanted to get one last feature release out before the year ended.

Highlights:

  • Full text search now does prefix and fuzzy search. There is no new API, just upgrade to 1.7 for the new behavior.
  • Improved database snapshot format. You can now backup and restore a snapshot of your entire database or seed new dev deployments from a snapshot.

Prefix and Fuzzy Search

Convex’s full-text search behavior has been updated designed to power as-you-type search experiences. Full-text search queries now automatically apply fuzzy and prefix matching rules to search terms, allowing searches to match documents which approximately match searches. As before, the documents are returned in relevance order and we’ve improved the quality of our relevance ranking.

Defining a search index has not changed and can still be done by adding the following 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",
  }),
});

Issuing a search query is still as simple as

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

Fuzzy search is applied to both the terms "fuzzy" and "search" in the query, matching documents such as

  • "fizzy soda"
  • "searchy"
  • "fuzzly cat"

In addition, prefix search is applied to the last term, matching documents such as

  • "searchability of logs is important in production systems"
  • "grep is a powerful searcher"

The ordering of documents returned also now takes into consideration a variety of relevance criteria such as the number of typos, the proximity and ordering of matches, and more!

Take the new full-text search for a spin to power your project’s application search and autocomplete features. To enable fuzzy and prefix search in your project, just update your Convex NPM version to 1.7! There are no breaking API changes.

To learn more about full text search and typo-tolerant search, check out the docs.

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

Improved Database Snapshot Export & Import

Snapshot export now creates ZIP files, and these ZIP files can be used with npx convex import to support new workflows:

  1. Store a backup of your deployment’s data, and restore from this backup at a later date.
  2. Seed new dev deployments with data from another deployment.

These imports preserve _id and _creationTime fields, so references between tables are maintained.

We also lifted size limits on npx convex import from 8MB→unlimited and document limit from 8192→unlimited.

Check out the docs on Export and Import for more details.

Caveat: exports from deployments created before version 1.7 might not be importable into other deployments.

Snapshot export and import are still beta features. If you have feedback or feature requests, let us know in Discord!