Aloha!又是我少女人妻 Uerica!這個連假又過了一場奇幻旅程,交了兩個好朋友,心得是原來我們都很少真誠地訴說自己的感受,但人與人要拉近彼此的距離,除了真誠與真心敞開,別無他法了阿~
搜尋設定就是利用 API 的方式查詢與更改與重設字詞 Weights 、 Boosts 狀態,以及設定與定義 raw 、 snippet 回傳字元。
GET 請求顯示 Engine 中資料欄位的 Weights 與 Boosts 的狀態
GET /api/as/v1/engines/{ENGINE_NAME}/search_settings
需用 private key
curl -X GET '{API_Endpoint}/api/as/v1/engines/{ENGINE_NAME}/search_settings' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer private-xxxxxxxxxx' \
-d ''
Response
{
"search_fields": {
"area": {
"weight": 2
},
"action_rule": {
"weight": 1
},
"place_name": {
"weight": 3
},
"note": {
"weight": 1
},
"address": {
"weight": 1
},
"city": {
"weight": 1
},
"bh": {
"weight": 1
},
"url": {
"weight": 1
},
"phone": {
"weight": 1
},
"stay_fee": {
"weight": 1
},
"place_type": {
"weight": 1
},
"place_desc": {
"weight": 1
},
"place_facility": {
"weight": 1
},
"close": {
"weight": 1
},
"open": {
"weight": 1
},
"lat": {
"weight": 1
},
"id": {
"weight": 1
}
},
"result_fields": {
"area": {
"raw": {}
},
"place_name": {
"raw": {}
},
"note": {
"raw": {}
},
"id": {
"raw": {}
},
"phone": {
"raw": {}
},
"place_desc": {
"raw": {}
}
},
"boosts": {}
}
PUT 更新 Engine 中資料欄位的 Weights 與 Boosts 的狀態
PUT /api/as/v1/engines/{ENGINE_NAME}/search_settings
{
"search_fields": {
"area": {
"weight": 4
},
"action_rule": {
"weight": 1
},
"place_name": {
"weight": 5
},
"note": {
"weight": 1
},
"address": {
"weight": 1
},
"city": {
"weight": 4
},
"bh": {
"weight": 1
},
"url": {
"weight": 1
},
"phone": {
"weight": 1
},
"stay_fee": {
"weight": 1
},
"place_type": {
"weight": 3
},
"place_desc": {
"weight": 2
},
"place_facility": {
"weight": 5
},
"close": {
"weight": 1
},
"open": {
"weight": 1
},
"lat": {
"weight": 1
},
"id": {
"weight": 1
}
},
"result_fields": {
"area": {
"raw": {}
},
"place_name": {
"raw": {}
},
"note": {
"raw": {}
},
"id": {
"raw": {}
},
"phone": {
"raw": {}
},
"place_desc": {
"snippet": {
"size": 20,
"fallback": true
}
}
},
"boosts": {
"place_type": [
{
"type": "value",
"factor": 9.5,
"value": [
"true"
]
}
]
}
}
POST 重設 Engine 中資料欄位的 Weights 與 Boosts 的狀態
POST /api/as/v1/engines/{ENGINE_NAME}/search_settings/reset
curl -X POST '{API_Endpoint}/api/as/v1/engines/{ENGINE_NAME}/search_settings/reset' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer private-xxxxxxxxxx' \
-d ''
感謝各位閱讀,祝福大家都跟身邊的人越來越親近 :)