Fusion

Version 5.1

Query Rewrite API

API Objective: Improve relevancy using AI-generated data.

This API manages documents used for query rewriting.

Examples

View configuration options

To see full configuration options using the Query Rewrite API:

  • All rules - https://fusion-host:6764/api/apps/<app-name>/query-rewrite/schema

  • Individual rules - https://fusion-host:6764/api/apps/<app-name>/query-rewrite/schema/<rule-type>

    The <rule-type> values are found at the …​/query-rewrite/schema endpoint: oneOf > 0 > properties > type > default.
{
    "pinned_values": {
        "type": "array",
        "title": "Pinned Documents",
        "description": "A list of one or more documents to boost and pin to specific positions in the results (1-based index). Note that pinning will only be applied to the first page of results.",
        "minItems": 1,
        "items": {
            "type": "object",
            "required": ["value", "position"],
            "properties": {
                "value": {
                    "type": "string",
                    "title": "Value",
                    "description": "Value to boost"
                },
                "position": {
                    "type": "integer",
                    "title": "Position",
                    "description": "Absolute position in the first page of results (1-based index)"
                }
            }
        }}},

Create a blocklist rule

Input
curl -u {usr}:{pw} -XPOST -H "Content-type:application/json" http://fusion-host:6764/api/apps/{app_id}/query-rewrite/instances -d
Output
{
  "id": "block_list_rule_1",
  "name": "block_list_rule_1",
  "type": "block_list",
  "field_name": "id",
  "field_values": ["6","17"],
  "enabled": true,
  "priority":11,
  "search_terms":["life"],
  "matching": "keywords"
}'

Update specific fields in an existing rule

Input
curl -u {usr}:{pw} -XPUT -H "Content-type:application/json" http://fusion-host:6764/api/apps/{app_id}/query-rewrite/instances -d
When making a PUT request to query-rewrite/instances include as a body JSON {"create":[],"update":[],"delete":[],} to avoid errors for missing properties.
Output
{
  "id": "block_list_rule_1",
  "name": "block_list_rule_1",
  "type": "block_list",
  "field_name": "id",
  "field_values": ["6","17"],
  "enabled": false,
  "priority":9,
  "search_terms":["life"],
  "matching": "keywords"
}'

Publish rules in the staging area

Input
curl -u {usr}:{pw} -X PUT -H 'Content-Type: application/json' http://fusion-host:6764/api/apps/{app_id}/query-rewrite/publish

Delete a published rule

Input
curl -u {usr}:{pw} -XPUT -H "Content-type:application/json" http://fusion-host:6764/api/apps/{app_id}/query-rewrite/instances -d
Output
{
  "delete": [ “block_list_rule_1" ]
}'

Publish an operation

Input
curl -u {usr}:{pw} -XPUT -H "Content-type:application/json" http://fusion-host:6764/api/apps/{app_id}/query-rewrite/publish
Loading API specification...