jc-isearch-client
v1.0.10
Published
jc-isearch-client
Downloads
13
Readme
jc-isearch-client
获取智能搜索接口
简介
开箱即用
安装
npm i jc-isearch-client
使用
import ISearchClient from "jc-isearch-client"; //引用
const isearch = new ISearchClient({
baseUrl: "https://172.******", //公共url(必填参数)
token:"", //token
});
// 普通搜索
isearch.topicSearches({
"key": "物流速递", //搜索关键词
"topicIds": [], //主题
"size": 10, //显示条数
"page": 1 , //页码
"url": "", //url(非必填,填写则覆盖此接口的公共url)
"token":"" //token(非必填,填写则覆盖此接口的公共token)
})
.then((res) => {
console.log(res);
});
//高级搜索
isearch.conditionSearches({ //高级搜索接口
"should": ["模型"], //包含以下任意一个关键词,多个关键字用逗号隔开
"must": [""], //包含以下全部关键词,多个关键字用逗号隔开
"mustNot": [""], //不包含以下关键词,多个关键字用逗号隔开
"notSplit": [""], //完整不拆分的关键词,多个关键字用逗号隔开
"startTime": "1677628800000", //开始时间(毫秒数)
"endTime": "1678147200000", //结束时间(毫秒数)
"topicIds": [], //主题 id,多个主题用逗号隔开
"sort": 0, //排序方式:0 相关性,1 发布时间正序,2 发布时间逆序
"size": 10, //显示条数
"page": 1 , //页码
"url": "", //url(非必填,填写则覆盖此接口的公共url)
"token":"" //token(非必填,填写则覆盖此接口的公共token)
}).then((res) => {
console.log(res);
});
// 主题
isearch.topicsList({
"url": "", //url(非必填,填写则覆盖此接口的公共url)
"token":"" //token(非必填,填写则覆盖此接口的公共token)
}).then((res) => {
console.log(res);
});
// 实体推荐
isearch.entityRecommendations({
"query": "物流速递", //搜索关键词
"url": "", //url(非必填,填写则覆盖此接口的公共url)
"token":"" //token(非必填,填写则覆盖此接口的公共token)
})
.then((res) => {
console.log(res);
});