Skip to content

Release v8.1.0

Choose a tag to compare

@github-actions github-actions released this 21 Jul 07:31

Preview: list and update for schema-based index documents (alpha)

⚠️ Alpha surface — all pc.preview.* APIs target the 2026-01.alpha API version and are not covered by the SDK's backward-compatibility guarantee. Signatures may change before these operations graduate to stable.

This release rounds out the document operations on pc.preview.index(...) introduced in v8.0.0 with two new methods — listDocuments and updateDocuments — and adds an n-gram (substring) tokenizer option to full-text search fields.

Listing documents

listDocuments returns document IDs for a namespace, with support for prefix filtering, a result limit, and cursor-based pagination.

const index = pc.preview.index('my-schema-index');

// List document IDs (supports prefix, limit, and pagination)
const page = await index.listDocuments('my-namespace', { prefix: 'doc-', limit: 50 });
// { documents: [{ _id: 'doc-1' }, ...], pagination: { next: '...' }, namespace, usage }

// Fetch the next page using the returned cursor
const next = await index.listDocuments('my-namespace', {
  paginationToken: page.pagination?.next,
});

Updating documents

updateDocuments applies partial updates to existing documents by _id. Set new field values inline, or remove fields via _remove_fields. Unmentioned fields are left unchanged, and updates to a nonexistent document are accepted as a no-op.

await index.updateDocuments('my-namespace', {
  documents: [
    { _id: 'doc-1', content: 'Updated content' },  // set a new value
    { _id: 'doc-2', _remove_fields: ['category'] }, // remove a field
  ],
});

n-gram tokenizer for full-text search

Full-text search string fields now accept an ngram (substring) tokenizer in their fullTextSearch configuration, enabling substring matching. Note that ngram cannot be combined with stemming or stopWords.

await pc.preview.indexes.create({
  name: 'my-schema-index',
  schema: {
    fields: {
      chunk_text: {
        type: 'string',
        fullTextSearch: {
          ngram: { minGram: 2, maxGram: 5 },
        },
      },
    },
  },
});

What's Changed

Full Changelog: v8.0.0...v8.1.0