SearchVectorExact
This class provides a database lookup for performing full-text search matches between a search vector and a search query. It automatically handles the conversion of right-hand side values into search query objects and generates the SQL using the match operator. This allows for precise filtering of search vectors against specific terms or combined search expressions.
Attributes
| Attribute | Type | Description |
|---|---|---|
| lookup_name | string = exact | The identifier used in Django ORM queries to trigger this specific full-text search comparison, set to "exact". |
Methods
process_rhs()
@classmethod
def process_rhs(
qn: compiler.SQLCompiler,
connection: db.backends.base.BaseDatabaseWrapper
) - > tuple
Prepares the right-hand side of the lookup by ensuring the search term is wrapped in a SearchQuery object, inheriting the configuration from the left-hand side if necessary.
Parameters
| Name | Type | Description |
|---|---|---|
| qn | compiler.SQLCompiler | The SQL compiler instance used to quote identifiers and generate the query string. |
| connection | db.backends.base.BaseDatabaseWrapper | The current database connection object used to handle backend-specific SQL generation. |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the SQL string for the right-hand side and the list of parameters for the query. |
as_sql()
@classmethod
def as_sql(
qn: compiler.SQLCompiler,
connection: db.backends.base.BaseDatabaseWrapper
) - > tuple
Generates the SQL fragment and parameters for the full-text search match operation using the '@@' operator.
Parameters
| Name | Type | Description |
|---|---|---|
| qn | compiler.SQLCompiler | The SQL compiler instance used to quote identifiers and generate the query string. |
| connection | db.backends.base.BaseDatabaseWrapper | The current database connection object used to handle backend-specific SQL generation. |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the formatted SQL string 'lhs @@ rhs' and the combined parameters from both sides. |