Product Selector

Fusion 5.12
    Fusion 5.12

    Query Rewrite APIFusion Query Rewrite API

    The Query Rewrite API manages documents used for query rewriting to improve relevancy using AI-generated data.

    Query Rewrite Rules Configuration

    To access detailed information about configuring the rewrite functions and rules for the Query Rewrite API, see Query Rewrite API Configurations.

    Examples

    View configuration options

    To see full configuration options using the Query Rewrite API:

    • All rules. https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/query-rewrite/schema

    • Individual rules. https://FUSION_HOST:FUSION_PORT/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

    curl -u USERNAME:PASSWORD -XPOST -H "Content-type:application/json" https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/query-rewrite/instances -d
    
    '{
      "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

    curl -u USERNAME:PASSWORD -XPUT -H "Content-type:application/json" https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/query-rewrite/instances -d
    
    '{
      "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"
    }'
    When making a PUT request to query-rewrite/instances include as a body JSON {"create":[],"update":[],"delete":[],} to avoid errors for missing properties.

    Publish rules in the staging area

    curl -u USERNAME:PASSWORD -X PUT -H 'Content-Type: application/json' https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/query-rewrite/publish

    Delete a published rule

    curl -u USERNAME:PASSWORD -XPUT -H "Content-type:application/json" https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/query-rewrite/instances -d
    
    '{
      "delete": [ “block_list_rule_1" ]
    }'

    Publish an operation

    curl -u USERNAME:PASSWORD -XPUT -H "Content-type:application/json" https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/query-rewrite/publish