Skip to content

Context7 Platform -- Up-to-date docs for AI agents

docs: document rank field on v3 search snippets (#3476)

context7[bot]1cf9b0ee46b6
diff --git a/docs/sdks/ts/commands/search.mdx b/docs/sdks/ts/commands/search.mdx
index 2252482e..d6585c5a 100644
--- a/docs/sdks/ts/commands/search.mdx
+++ b/docs/sdks/ts/commands/search.mdx
@@ -58,7 +58,7 @@ console.log(context);
## JSON response
-JSON responses return a `SearchResponse` object with `codeSnippets`, `infoSnippets`, and optional `rules`. Each snippet includes the `libraryId` that it came from.
+JSON responses return a `SearchResponse` object with `codeSnippets`, `infoSnippets`, and optional `rules`. Each snippet includes the `libraryId` that it came from and a `rank`, its 1-based position in the reranked order shared by both lists. Sort `codeSnippets` and `infoSnippets` together by `rank` to read the snippets in the order the text response gives them.
```typescript
import { Context7 } from "@upstash/context7-sdk";
diff --git a/docs/search-api.mdx b/docs/search-api.mdx
index aca2da22..b8b39bd1 100644
--- a/docs/search-api.mdx
+++ b/docs/search-api.mdx
@@ -58,6 +58,8 @@ The REST endpoint returns plain text by default, ready to add to a prompt. Set `
Every snippet includes the library it came from and a link to the source page.
+JSON results split the snippets into `codeSnippets` and `infoSnippets`. Each snippet carries `rank`, its 1-based position across both lists. Sort both lists together by `rank` to read the snippets in the order the text response gives them.
+
## Add hints
A query is all you need. If you know the library, version, or language, add them to narrow the results: