Add ability to configure NGRAM's
This commit is contained in:
parent
9a792e10e3
commit
251e924122
@ -92,6 +92,8 @@ The backend has the following optional settings:
|
||||
See `here <http://xapian.org/docs/apidoc/html/classXapian_1_1QueryParser.html#ac7dc3b55b6083bd3ff98fc8b2726c8fd>`__ for
|
||||
more information about the different strategies.
|
||||
|
||||
- ``XAPIAN_NGRAM_MIN_LENGTH``, ``XAPIAN_NGRAM_MAX_LENGTH``: options for custom configuration of ngrams (phrases) length.
|
||||
|
||||
- ``HAYSTACK_XAPIAN_USE_LOCKFILE``: Use a lockfile to prevent database locking errors when running management commands with multiple workers.
|
||||
Defaults to `True`.
|
||||
|
||||
|
@ -19,8 +19,8 @@ from haystack.inputs import AutoQuery
|
||||
from haystack.models import SearchResult
|
||||
from haystack.utils import get_identifier, get_model_ct
|
||||
|
||||
NGRAM_MIN_LENGTH = 2
|
||||
NGRAM_MAX_LENGTH = 15
|
||||
NGRAM_MIN_LENGTH = getattr(settings, 'XAPIAN_NGRAM_MIN_LENGTH', 2)
|
||||
NGRAM_MAX_LENGTH = getattr(settings, 'XAPIAN_NGRAM_MAX_LENGTH', 15)
|
||||
|
||||
try:
|
||||
import xapian
|
||||
|
Loading…
Reference in New Issue
Block a user