mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 16:53:10 +00:00
Iterate over the full resultset of execute_sql(result_type=MULTI) when filtering by __in with a subquery
This ensures that it will work equivalently for lists (as returned when connection.features.can_use_chunked_reads is False) as for iterators, and means we don't need to worry about missing results if we ever receive a chunked resultset.
This commit is contained in:
parent
0ac90f0d58
commit
39c9372e52
1 changed files with 2 additions and 4 deletions
|
|
@ -340,10 +340,8 @@ class Elasticsearch2SearchQuery(BaseSearchQuery):
|
|||
if lookup == 'in':
|
||||
if isinstance(value, Query):
|
||||
db_alias = self.queryset._db or DEFAULT_DB_ALIAS
|
||||
value = next(value.get_compiler(db_alias)
|
||||
.execute_sql(result_type=MULTI))
|
||||
|
||||
value = [r[0] for r in value]
|
||||
resultset = value.get_compiler(db_alias).execute_sql(result_type=MULTI)
|
||||
value = [row[0] for chunk in resultset for row in chunk]
|
||||
|
||||
elif not isinstance(value, list):
|
||||
value = list(value)
|
||||
|
|
|
|||
Loading…
Reference in a new issue