Mintlify Index
搜索技术知识
在 Mintlify Index 中搜索排名后的技术文档和 Web 结果。
POST
/
v1
/
search
搜索技术知识
curl --request POST \
--url https://leaves.mintlify.com/api/universal-search/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "Next.js 16 缓存与重新验证",
"numResults": 5,
"text": {
"maxCharacters": 4000
},
"includeDomains": [
"nextjs.org"
]
}
'import requests
url = "https://leaves.mintlify.com/api/universal-search/v1/search"
payload = {
"query": "Next.js 16 缓存与重新验证",
"numResults": 5,
"text": { "maxCharacters": 4000 },
"includeDomains": ["nextjs.org"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'Next.js 16 缓存与重新验证',
numResults: 5,
text: {maxCharacters: 4000},
includeDomains: ['nextjs.org']
})
};
fetch('https://leaves.mintlify.com/api/universal-search/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://leaves.mintlify.com/api/universal-search/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'Next.js 16 缓存与重新验证',
'numResults' => 5,
'text' => [
'maxCharacters' => 4000
],
'includeDomains' => [
'nextjs.org'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://leaves.mintlify.com/api/universal-search/v1/search"
payload := strings.NewReader("{\n \"query\": \"Next.js 16 缓存与重新验证\",\n \"numResults\": 5,\n \"text\": {\n \"maxCharacters\": 4000\n },\n \"includeDomains\": [\n \"nextjs.org\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://leaves.mintlify.com/api/universal-search/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"Next.js 16 缓存与重新验证\",\n \"numResults\": 5,\n \"text\": {\n \"maxCharacters\": 4000\n },\n \"includeDomains\": [\n \"nextjs.org\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leaves.mintlify.com/api/universal-search/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"Next.js 16 缓存与重新验证\",\n \"numResults\": 5,\n \"text\": {\n \"maxCharacters\": 4000\n },\n \"includeDomains\": [\n \"nextjs.org\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"requestId": "3d8ed0aa-c21c-4a18-b995-207aa6315ea8",
"results": [
{
"id": "nextjs:/docs/app/getting-started/caching-and-revalidating",
"url": "https://nextjs.org/docs/app/getting-started/caching-and-revalidating",
"title": "缓存与重新验证",
"text": "缓存是一种存储数据获取和其他计算结果的技术。",
"truncated": false,
"totalCharacters": 92,
"score": 0.91,
"source": "mintlify",
"siteName": "nextjs",
"breadcrumbs": [
"应用路由",
"开始使用"
],
"publishedDate": null
}
]
}{
"error": "请求正文无效"
}{
"error": "未授权"
}{
"error": "该 API key 不允许此 IP 地址"
}{
"error": "超出速率限制。请稍后重试"
}{
"error": "<string>"
}授权
带有 mint_us_ 前缀的 Mintlify Index API 密钥。
请求体
application/json
搜索查询。
Minimum string length:
1要返回的最大结果数。
必填范围:
1 <= x <= 20控制结果内容。设置为 true 可包含匹配的内容,设置为 false 可省略内容,或提供 maxCharacters 以包含截断后的内容。省略时默认为 false。
要包含在搜索结果中的域名。
Minimum array length:
1Minimum string length:
1要从搜索结果中排除的域名。
Minimum array length:
1Minimum string length:
1⌘I
搜索技术知识
curl --request POST \
--url https://leaves.mintlify.com/api/universal-search/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "Next.js 16 缓存与重新验证",
"numResults": 5,
"text": {
"maxCharacters": 4000
},
"includeDomains": [
"nextjs.org"
]
}
'import requests
url = "https://leaves.mintlify.com/api/universal-search/v1/search"
payload = {
"query": "Next.js 16 缓存与重新验证",
"numResults": 5,
"text": { "maxCharacters": 4000 },
"includeDomains": ["nextjs.org"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'Next.js 16 缓存与重新验证',
numResults: 5,
text: {maxCharacters: 4000},
includeDomains: ['nextjs.org']
})
};
fetch('https://leaves.mintlify.com/api/universal-search/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://leaves.mintlify.com/api/universal-search/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'Next.js 16 缓存与重新验证',
'numResults' => 5,
'text' => [
'maxCharacters' => 4000
],
'includeDomains' => [
'nextjs.org'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://leaves.mintlify.com/api/universal-search/v1/search"
payload := strings.NewReader("{\n \"query\": \"Next.js 16 缓存与重新验证\",\n \"numResults\": 5,\n \"text\": {\n \"maxCharacters\": 4000\n },\n \"includeDomains\": [\n \"nextjs.org\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://leaves.mintlify.com/api/universal-search/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"Next.js 16 缓存与重新验证\",\n \"numResults\": 5,\n \"text\": {\n \"maxCharacters\": 4000\n },\n \"includeDomains\": [\n \"nextjs.org\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leaves.mintlify.com/api/universal-search/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"Next.js 16 缓存与重新验证\",\n \"numResults\": 5,\n \"text\": {\n \"maxCharacters\": 4000\n },\n \"includeDomains\": [\n \"nextjs.org\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"requestId": "3d8ed0aa-c21c-4a18-b995-207aa6315ea8",
"results": [
{
"id": "nextjs:/docs/app/getting-started/caching-and-revalidating",
"url": "https://nextjs.org/docs/app/getting-started/caching-and-revalidating",
"title": "缓存与重新验证",
"text": "缓存是一种存储数据获取和其他计算结果的技术。",
"truncated": false,
"totalCharacters": 92,
"score": 0.91,
"source": "mintlify",
"siteName": "nextjs",
"breadcrumbs": [
"应用路由",
"开始使用"
],
"publishedDate": null
}
]
}{
"error": "请求正文无效"
}{
"error": "未授权"
}{
"error": "该 API key 不允许此 IP 地址"
}{
"error": "超出速率限制。请稍后重试"
}{
"error": "<string>"
}