Skip to content
Catalog

cn8/text-search

Send a query and a list of documents, and get them back ranked by semantic

Learn more about Semantic Search
Text NLPsyncInstant previewtextanalysisnlp

Try it

Query
DocumentsOne document per line — the query is matched against these.

Result

Results show up here

The sample input is ready — just hit Run.

Overview

Send a query and a list of documents, and get them back ranked by semantic similarity to the query. Each result includes its rank, the original document text, a similarity score, and its index in your input list. The response also echoes the query and the total number of documents ranked. Because matching is by meaning, a query about "resetting credentials" still matches "change your password". Responses are synchronous — one request, one ranked list.

Key capabilities

Semantic ranking

Ranks by meaning, not just keyword overlap. A query about 'resetting credentials' matches 'change your password' even with no shared words.

Rank, score and original index

Each result includes its 1-based rank, the document text, a similarity score, and the document's original index in your input list.

Query echo

The response repeats the query and total document count — handy for logging.

Multilingual

Query and documents can be in different languages — they're mapped into the same meaning space.

When to use it

Document retrieval

Retrieve the most relevant chunks from a document set for a user query.

FAQ matching

Match a user question to the closest FAQ entry by meaning.

Recommendation

Find similar articles, products, or entries from a query or item description.

Input & output

input

A query string and a documents array of strings.

JSON body

output

Ranked results (rank, text, score, index), the echoed query, and the total document count.

JSON

Guides & tips

How it works

  • The query and every document are compared by meaning, and the documents are returned ranked from most to least relevant.
  • Each result carries its rank, the document text, a similarity score, and the index it had in your input list.
  • All documents are ranked and returned. If you only want the top matches, take the first N entries of results in your own code.

Tips for better results

  • Keep documents focused (e.g. paragraphs, not entire articles) for more precise matching.
  • For large-scale or repeated retrieval over thousands of documents, pre-compute vectors with Text Embeddings and store them in a vector database.
  • Use this endpoint for ad-hoc ranking over modest lists per request.

Specs

Latency
Typically 0.5–3 seconds depending on document count
Async
false
Rate Limit
Per API key
Max Input
Up to a few hundred documents per request

Schema

Request body

queryrequiredstring

The search query.

documentsrequiredarray<string>

The list of candidate documents to rank against the query.

Response

results[].rankinteger

1-based rank position.

results[].textstring

The original document text.

results[].scorenumber

Similarity to the query, from 0 to 1.

results[].indexinteger

The document's original 0-based index in your documents array.

querystring

The query you sent, echoed back.

total_documentsinteger

Number of documents that were ranked.

Pricing

Billed per request.

ServiceUnitPrice
Semantic Searchitem$0.004/request

Price is per request, regardless of how many documents you rank.

FAQ

Related models