SearchLookup
This class provides a specialized lookup for full-text search operations by extending exact search vector functionality. It automatically handles the conversion of standard fields into search vectors using an optional configuration from the right-hand side of the expression. The class ensures that the left-hand side is compatible with search vector fields during query processing.
Attributes
| Attribute | Type | Description |
|---|---|---|
| lookup_name | string = search | The identifier used in Django querysets to perform a full-text search operation, set to "search". |
Methods
process_lhs()
@classmethod
def process_lhs(
qn: django.db.models.sql.compiler.SQLCompiler,
connection: django.db.backends.base.base.BaseDatabaseWrapper
) - > tuple
Processes the left-hand side of the search lookup, ensuring the field is cast to a SearchVectorField if it is not already one.
Parameters
| Name | Type | Description |
|---|---|---|
| qn | django.db.models.sql.compiler.SQLCompiler | The SQL compiler instance used to generate the query string. |
| connection | django.db.backends.base.base.BaseDatabaseWrapper | The current database connection used to handle backend-specific SQL generation. |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the SQL string for the left-hand side and the list of parameters to be bound to the query. |