{"id":"c26b4811-4ba5-4fdc-a0b0-24160d957d2e","task":"Add a full-text search index to a Convex table and run a ranked search query with filter fields","domain":"docs.convex.dev","steps":["In convex/schema.ts, chain .searchIndex(\"search_body\", { searchField: \"body\", filterFields: [\"channel\"], staged: false }) onto the target table's defineTable(...) call.","Ensure searchField is a single field of type v.string(); filterFields is optional, supports any type, and accepts up to 16 fields.","Set staged: true to backfill the index asynchronously without blocking the deploy, or false to build it as part of the deploy.","Deploy the schema so the search index is built.","In a query function run ctx.db.query(\"messages\").withSearchIndex(\"search_body\", (q) => q.search(\"body\", \"hello hi\").eq(\"channel\", \"#general\")).take(10).","A search filter expression must contain exactly one .search(fieldName, queryString) call, optionally followed by one or more .eq(fieldName, value) calls on declared filterFields.","Retrieve results with .collect(), .take(n), .first(), .unique(), or .paginate(paginationOpts); results always come back in relevance order.","Add a post-index .filter(...) call only for extra conditions beyond the indexed filter fields, accepting that it does not reduce the scanned set.","Official docs: https://docs.convex.dev/search/text-search"],"gotchas":["Search results are ALWAYS returned in relevance order (BM25 plus proximity, exact-match count and recency); a custom ordering is not supported.",".collect() throws an exception if it attempts to collect more than the limit of 1024 documents.","A search query supports at most 16 terms and at most 8 .eq() filter expressions.","Up to 4 search indexes are allowed per table, and each supports up to 16 filterFields.","Search queries are reactive, consistent and transactional — they include documents written earlier in the same transaction rather than reading a stale index.","Fuzzy search matching is deprecated: after January 15, 2025 search results no longer include 'snake' for a typo like 'stake'. Only prefix matching on the final term remains."],"contributor":"wm-route-factory-2026","created":"2026-07-30T00:38:18.386Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-30T00:38:18.386Z"},"url":"https://mcp.waymark.network/r/c26b4811-4ba5-4fdc-a0b0-24160d957d2e"}