import requests
url = "https://{FUSION_HOST}/api/query-rewrite/instances/{id}"
payload = {}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.put("https://{FUSION_HOST}/api/query-rewrite/instances/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{}")
.asString();const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://{FUSION_HOST}/api/query-rewrite/instances/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION_HOST}/api/query-rewrite/instances/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION_HOST}/api/query-rewrite/instances/{id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION_HOST}/api/query-rewrite/instances/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request PUT \
--url https://{FUSION_HOST}/api/query-rewrite/instances/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '{}'{
"type": "banner",
"id": "<string>",
"source": "<string>",
"sourceType": "<string>",
"createdOn": "2023-11-07T05:31:56Z",
"updatedOn": "2023-11-07T05:31:56Z",
"reviewer": "<string>",
"reviewedOn": "2023-11-07T05:31:56Z",
"review": "auto",
"deployed": true,
"tags": [
"<string>"
],
"is_deleted": true,
"base_object_id_s": "<string>",
"doc_type": "<string>",
"description": "<string>",
"priority": 1,
"matching": "keywords",
"groups": "<string>",
"rollup": "<string>"
}Update a query rewrite
Use this endpoint to change a query rewrite’s attributes. The request is a JSON body containing the updated attributes.
import requests
url = "https://{FUSION_HOST}/api/query-rewrite/instances/{id}"
payload = {}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.put("https://{FUSION_HOST}/api/query-rewrite/instances/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{}")
.asString();const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://{FUSION_HOST}/api/query-rewrite/instances/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION_HOST}/api/query-rewrite/instances/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION_HOST}/api/query-rewrite/instances/{id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION_HOST}/api/query-rewrite/instances/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request PUT \
--url https://{FUSION_HOST}/api/query-rewrite/instances/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '{}'{
"type": "banner",
"id": "<string>",
"source": "<string>",
"sourceType": "<string>",
"createdOn": "2023-11-07T05:31:56Z",
"updatedOn": "2023-11-07T05:31:56Z",
"reviewer": "<string>",
"reviewedOn": "2023-11-07T05:31:56Z",
"review": "auto",
"deployed": true,
"tags": [
"<string>"
],
"is_deleted": true,
"base_object_id_s": "<string>",
"doc_type": "<string>",
"description": "<string>",
"priority": 1,
"matching": "keywords",
"groups": "<string>",
"rollup": "<string>"
}Authorizations
Query Parameters
Body
The type of rule, written in snake case. In the Fusion UI, some of these types correspond to the types in the Rewrites Manager and others correspond to actions in the Rules Manager.
banner- A rule that adds an HTML-formatted banner to query responses.block_list- A rule that blocks values from appearing in query results.boost_attributes- A rule that boosts documents in query results.boost_list- A rule that boosts documents with a large multiplicative boost.bury_list- A rule that buries documents so they are minimized but not blocked.filter_list- A rule that applies filter queries (fq) to matching queries.ground_truth- A query rewrite that estimates ground truth queries using click signals and query signals.ingroup_boost_list- A rule that boosts an item within a product group.ingroup_bury_list- A rule that buries an item within a product group.ingroup_pinned- A rule that pins a document to a specific location within a product group.json_blob- A rule that returns an arbitrary JSON blob for display outside of the search results.phrase- A query rewrite that boosts phrases when they appear in queries.pinned- A rule that pins a document to a specific location within the search results.redirect- A rule that adds a redirect message to the query response.removeWords- A query rewrite that removes phrases from queries.response_value- A rule that sends an arbitrary value to the front end or pipeline.set_facets- A rule that customizes the facets returned in the query response.set_params- A rule that sets a parameter name and value to a search query.simq- A query rewrite that detects overlap between the results of similar queries.spell- A query rewrite that maps misspellings to their corrected spellings.synonym- A query rewrite that maps query terms to their synonyms.tail- A query rewrite that replaces under-performing queries with queries that produce higher click-through rates.
banner, block_list, boost_attributes, boost_list, bury_list, filter_list, ground_truth, ingroup_boost_list, ingroup_bury_list, ingroup_pinned, json_blob, phrase, pinned, redirect, removeWords, response_value, set_facets, set_params, simq, spell, synonym, tail Specifies the rule’s precedence when multiple rules could apply to the same query.
A higher number means higher precedence. For example, a rule with precedence of 10 will take effect before a rule with precedence of 3.
If two rules have the same precedence, the newer rule takes effect first.
Defines how the specified search terms will be compared to the user's query to determine whether this rule applies. 'keywords' means the query must match the keywords of the search terms value exactly. 'phrase' means the search query must contain one of the search terms values as a subphrase. 'text' means that at least one of the search terms values must match the query, but unlike 'phrase', the query only needs to match part of the value.
keywords, text, phrase Response
OK
The type of rule, written in snake case. In the Fusion UI, some of these types correspond to the types in the Rewrites Manager and others correspond to actions in the Rules Manager.
banner- A rule that adds an HTML-formatted banner to query responses.block_list- A rule that blocks values from appearing in query results.boost_attributes- A rule that boosts documents in query results.boost_list- A rule that boosts documents with a large multiplicative boost.bury_list- A rule that buries documents so they are minimized but not blocked.filter_list- A rule that applies filter queries (fq) to matching queries.ground_truth- A query rewrite that estimates ground truth queries using click signals and query signals.ingroup_boost_list- A rule that boosts an item within a product group.ingroup_bury_list- A rule that buries an item within a product group.ingroup_pinned- A rule that pins a document to a specific location within a product group.json_blob- A rule that returns an arbitrary JSON blob for display outside of the search results.phrase- A query rewrite that boosts phrases when they appear in queries.pinned- A rule that pins a document to a specific location within the search results.redirect- A rule that adds a redirect message to the query response.removeWords- A query rewrite that removes phrases from queries.response_value- A rule that sends an arbitrary value to the front end or pipeline.set_facets- A rule that customizes the facets returned in the query response.set_params- A rule that sets a parameter name and value to a search query.simq- A query rewrite that detects overlap between the results of similar queries.spell- A query rewrite that maps misspellings to their corrected spellings.synonym- A query rewrite that maps query terms to their synonyms.tail- A query rewrite that replaces under-performing queries with queries that produce higher click-through rates.
banner, block_list, boost_attributes, boost_list, bury_list, filter_list, ground_truth, ingroup_boost_list, ingroup_bury_list, ingroup_pinned, json_blob, phrase, pinned, redirect, removeWords, response_value, set_facets, set_params, simq, spell, synonym, tail Specifies the rule’s precedence when multiple rules could apply to the same query.
A higher number means higher precedence. For example, a rule with precedence of 10 will take effect before a rule with precedence of 3.
If two rules have the same precedence, the newer rule takes effect first.
Defines how the specified search terms will be compared to the user's query to determine whether this rule applies. 'keywords' means the query must match the keywords of the search terms value exactly. 'phrase' means the search query must contain one of the search terms values as a subphrase. 'text' means that at least one of the search terms values must match the query, but unlike 'phrase', the query only needs to match part of the value.
keywords, text, phrase Was this page helpful?