A rough sort expression configured for a version of an OpenSearch application. FirstRank supports two expression types: a structured list of scoring functions (STRUCT) or a custom formula string (STRING).
Examples
STRUCT type — a structured expression using a built-in scoring function:
{
"name": "default",
"description": "",
"active": true,
"type": "STRUCT",
"meta": [
{
"attribute": "static_bm25()",
"arg": "",
"weight": 10
}
]
}STRING type — a custom formula expression:
{
"name": "my_demo",
"description": "",
"active": false,
"type": "STRING",
"meta": "random()*100+now()"
}Structure
| Field | Type | Description |
|---|---|---|
| name | String | The name of the expression. |
| description | String | The description of the expression. |
| active | Boolean | Specifies whether this is the default rough sort expression. |
| type | String | The type of the expression. Valid values: <br>- STRUCT: The expression is defined as a structured list of scoring functions. This is the default value. <br>- STRING: The expression is defined as a custom formula. |
| meta | Array or String | The content of the expression. The type depends on the type field: an array when type is STRUCT, or a string when type is STRING. |
meta fields (when `type` is `STRUCT`)
| Field | Type | Description |
|---|---|---|
| [].attribute | String | The function used for score calculation or the field to search. For valid values, see Rough sort functions. |
| [].arg | String | The parameters passed to the function. For valid values, see Rough sort functions. |
| [].weight | Number | The weight. Valid values: [-100000, 100000] (excluding 0). |
该文章对您有帮助吗?