TrigramWordBase
This class represents a database function used to calculate the trigram similarity between a specific string and a given expression. It initializes with a string value and an expression, ensuring the input string is treated as a value if it does not already support expression resolution. The function typically returns a floating-point value representing the similarity score.
Attributes
| Attribute | Type | Description |
|---|---|---|
| output_field | [FloatField](../../../forms/fields/floatfield.md?sid=django_forms_fields_floatfield) = FloatField() | Specifies that the result of the trigram function should be treated as a floating-point number. |
Constructor
Signature
def TrigramWordBase(
string: Any,
expression: Any,
**extra: dict
)
Parameters
| Name | Type | Description |
|---|---|---|
| string | Any | The string to be evaluated, which is converted to a Value object if it lacks a resolve_expression method. |
| expression | Any | The expression to compare against the string. |
| **extra | dict | Additional keyword arguments passed to the parent Func class. |
Signature
def TrigramWordBase(
string: str | Expression,
expression: [Expression](../../../db/models/expressions/expression.md?sid=django_db_models_expressions_expression),
**extra: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| string | `str | Expression` |
| expression | [Expression](../../../db/models/expressions/expression.md?sid=django_db_models_expressions_expression) | The database column or expression against which the trigram similarity is calculated. |
| **extra | dict | Additional keyword arguments passed to the underlying Func class for configuring database function behavior. |