0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Use search_type='raw' on Django 3.1

This commit is contained in:
Matt Westcott 2020-07-03 21:09:11 +01:00 committed by Matt Westcott
parent 4879583fac
commit 36ad953658

View File

@ -2,6 +2,7 @@ import warnings
from collections import OrderedDict
from functools import reduce
from django import VERSION as DJANGO_VERSION
from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector
from django.db import DEFAULT_DB_ALIAS, NotSupportedError, connections, transaction
from django.db.models import Avg, Count, F, Manager, Q, TextField, Value
@ -375,7 +376,10 @@ class PostgresSearchQueryCompiler(BaseSearchQueryCompiler):
else:
lexemes |= new_lexeme
return RawSearchQuery(lexemes, config=config)
if DJANGO_VERSION >= (3, 1):
return SearchQuery(lexemes, search_type='raw', config=config)
else:
return RawSearchQuery(lexemes, config=config)
elif isinstance(query, Phrase):
return SearchQuery(query.query_string, search_type='phrase')