kopia lustrzana https://github.com/wagtail/wagtail
Deprecate the partial_match argument
rodzic
db691b5f1b
commit
8ceede175f
|
@ -213,6 +213,14 @@ The following features deprecated in Wagtail 4.0 have been fully removed. See [W
|
|||
|
||||
Django 4.0 reached end of life on 1st April 2023 and is no longer supported by Wagtail. Django 3.2 (LTS) is still supported until April 2024.
|
||||
|
||||
### Elasticsearch backend no longer performs partial matching on `search`
|
||||
|
||||
The `search` method on pages, images and documents, and on the backend object returned by `wagtail.search.backends.get_search_backend()`, no longer performs partial word matching when the Elasticsearch backend is in use. Previously, a search query such as `Page.objects.search("cat")` would return results containing the word "caterpillar", while `Page.objects.search("cat", partial_match=False)` would only return results for the exact word "cat". The `search` method now always performs exact word matches, and the `partial_match` argument has no effect. This change makes the Elasticsearch backend consistent with the database-backed full-text search backends.
|
||||
|
||||
To revert to the previous partial word matching behaviour, use the `autocomplete` method instead - for example, `Page.objects.autocomplete("cat")`. It may also be necessary to add an [](wagtailsearch_index_autocompletefield) entry for the relevant fields on the model's `search_fields` definition, as the old `SearchField("some_field", partial_match=True)` format is no longer supported.
|
||||
|
||||
The `partial_match` argument on `search` and `SearchField` is now deprecated, and should be removed from your code; it will be dropped entirely in Wagtail 6.
|
||||
|
||||
### `Page.get_static_site_paths` method removed
|
||||
|
||||
The undocumented `Page.get_static_site_paths` method (which returns a generator of URL paths for use by static site generator packages) has been removed. Packages relying on this functionality should provide their own fallback implementation.
|
||||
|
|
|
@ -110,6 +110,8 @@ These are used for performing full-text searches on your models, usually for tex
|
|||
The `partial_match` option has been deprecated. To index a field for partial matching, use `AutocompleteField` instead.
|
||||
```
|
||||
|
||||
(wagtailsearch_index_autocompletefield)=
|
||||
|
||||
### `index.AutocompleteField`
|
||||
|
||||
These are used for autocomplete queries that match partial words. For example, a page titled `Hello World!` will be found if the user only types `Hel` into the search box.
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.db.models.sql.where import SubqueryConstraint, WhereNode
|
|||
|
||||
from wagtail.search.index import class_is_indexed, get_indexed_models
|
||||
from wagtail.search.query import MATCH_ALL, PlainText
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
|
||||
|
||||
class FilterError(Exception):
|
||||
|
@ -56,7 +57,18 @@ class BaseSearchQueryCompiler:
|
|||
self.query = query
|
||||
self.fields = fields
|
||||
self.order_by_relevance = order_by_relevance
|
||||
self.partial_match = partial_match # RemovedInWagtail60Warning
|
||||
if partial_match:
|
||||
warn(
|
||||
"The partial_match=True argument on `search` is no longer supported. "
|
||||
"Use the `autocomplete` method instead",
|
||||
category=RemovedInWagtail60Warning,
|
||||
)
|
||||
elif partial_match is not None:
|
||||
warn(
|
||||
"The partial_match=False argument on `search` is no longer required "
|
||||
"and should be removed",
|
||||
category=RemovedInWagtail60Warning,
|
||||
)
|
||||
|
||||
def _get_filterable_field(self, field_attname):
|
||||
# Get field
|
||||
|
|
Ładowanie…
Reference in New Issue