django/django — pull request #2597 by jkbr (2014-04-22 16:32:44+00:00)
Title: Add missing `as_sql()` for `__search` lookup

The (MySQL-only) `__search` lookup wasn't properly implemented using the new ORM lookup system. It's use would result into a runtime exception:

```python
return node.as_sql(self, self.connection)
File "/site-packages/django/db/models/sql/where.py", line 106, in as_sql
sql, params = qn.compile(child)
File "/site-packages/django/db/models/sql/compiler.py", line 80, in compile
return node.as_sql(self, self.connection)
File "/site-packages/django/db/models/sql/where.py", line 106, in as_sql
sql, params = qn.compile(child)
File "/site-packages/django/db/models/sql/compiler.py", line 80, in compile
return node.as_sql(self, self.connection)
File "/site-packages/django/db/models/lookups.py", line 150, in as_sql
rhs_sql = self.get_rhs_op(connection, rhs_sql)
File "/site-packages/django/db/models/lookups.py", line 154, in get_rhs_op
return connection.operators[self.lookup_name] % rhs
KeyError: 'search'
```

This implementation uses the existing SQL template provided by `BaseDatabaseOperations.fulltext_search_sql(field_name)`.