mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-12 01:26:47 +01:00
Fixes relative date Whoosh queries and adds testing to ensure it remains working with multiple timezones
This commit is contained in:
parent
dae4550bc3
commit
dc7bef5d48
2 changed files with 268 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ from contextlib import contextmanager
|
|||
|
||||
from dateutil.parser import isoparse
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
from documents.models import Comment
|
||||
from documents.models import Document
|
||||
from whoosh import classify
|
||||
|
|
@ -262,7 +263,7 @@ class DelayedFullTextQuery(DelayedQuery):
|
|||
["content", "title", "correspondent", "tag", "type", "comments"],
|
||||
self.searcher.ixreader.schema,
|
||||
)
|
||||
qp.add_plugin(DateParserPlugin())
|
||||
qp.add_plugin(DateParserPlugin(basedate=timezone.now()))
|
||||
q = qp.parse(q_str)
|
||||
|
||||
corrected = self.searcher.correct_query(q, q_str)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue