Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
d9c27b07f6
|
@ -42,16 +42,15 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.7', '3.8', '3.9', '3.10']
|
||||
django-version: ['2.2', '3.2', '4.0']
|
||||
django-version: ['3.2', '4.0', '4.1']
|
||||
xapian-version: ['1.4.19']
|
||||
filelock-version: ['3.4.2']
|
||||
exclude:
|
||||
# Django added python 3.10 support in 3.2.9
|
||||
- python-version: '3.10'
|
||||
django-version: '2.2'
|
||||
# Django dropped python 3.7 support in 4.0
|
||||
- python-version: '3.7'
|
||||
django-version: '4.0'
|
||||
- python-version: '3.7'
|
||||
django-version: '4.1'
|
||||
|
||||
steps:
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
xapian-haystack Changelog
|
||||
=========================
|
||||
|
||||
Unreleased
|
||||
----------
|
||||
v3.1.0 (2023-03-19)
|
||||
-------------------
|
||||
|
||||
- Add DJANGO_CT, DJANGO_ID, ID to be used with '__exact' internally.
|
||||
- Ability to configure ngram min and max lengths.
|
||||
- Supported Django versions: 3.2, 4.0, 4.1
|
||||
- Dropped support for Python 3.6.
|
||||
- Fixed DatabaseLocked errors when running management commands with
|
||||
multiple workers.
|
||||
|
|
4
setup.py
4
setup.py
|
@ -8,7 +8,7 @@ def read(fname):
|
|||
|
||||
setup(
|
||||
name='xapian-haystack',
|
||||
version='3.0.1',
|
||||
version='3.1.0',
|
||||
description='A Xapian backend for Haystack',
|
||||
long_description=read('README.rst'),
|
||||
long_description_content_type='text/x-rst',
|
||||
|
@ -26,7 +26,7 @@ setup(
|
|||
license='GPL2',
|
||||
py_modules=['xapian_backend'],
|
||||
install_requires=[
|
||||
'django>=2.2',
|
||||
'django>=3.2',
|
||||
'django-haystack>=2.8.0',
|
||||
'filelock>=3.4',
|
||||
]
|
||||
|
|
|
@ -236,6 +236,13 @@ class XapianSearchQueryTestCase(HaystackBackendTestCase, TestCase):
|
|||
self.sq.add_filter(SQ(django_ct='time'))
|
||||
self.assertExpectedQuery(self.sq.build_query(), 'CONTENTTYPEtime')
|
||||
|
||||
def test_unphrased_id(self):
|
||||
'An internal ID should NOT be phrased so one can exclude IDs.'
|
||||
self.sq.add_filter(SQ(id__in=['testing123', 'testing456']))
|
||||
expected = '(Qtesting123 OR Qtesting456)'
|
||||
self.assertExpectedQuery(
|
||||
query=self.sq.build_query(), string_or_list=expected)
|
||||
|
||||
|
||||
class SearchQueryTestCase(HaystackBackendTestCase, TestCase):
|
||||
"""
|
||||
|
|
|
@ -48,6 +48,8 @@ TERM_PREFIXES = {
|
|||
'field': 'X'
|
||||
}
|
||||
|
||||
_EXACT_SEARCHFIELDS = frozenset((DJANGO_CT, DJANGO_ID, ID))
|
||||
|
||||
MEMORY_DB_NAME = ':memory:'
|
||||
|
||||
DEFAULT_XAPIAN_FLAGS = (
|
||||
|
@ -1443,7 +1445,7 @@ class XapianSearchQuery(BaseSearchQuery):
|
|||
|
||||
Assumes term is not a list.
|
||||
"""
|
||||
if field_type == 'text' and field_name not in (DJANGO_CT,):
|
||||
if field_type == 'text' and field_name not in _EXACT_SEARCHFIELDS:
|
||||
term = '^ %s $' % term
|
||||
query = self._phrase_query(term.split(), field_name, field_type)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue