Wagtail 2.10 compatability?
DIGIREN opened this issue · comments
Hey everyone,
Any plans to update this package to be compatible with 2.10? Ive been using it with 2.9 and now 2.10 with no issues, but with the new pip dependency resolver coming out soon, I wont be able to keep installing a technically incompatible version. Is checking compatibility and potentially updating the required wagtail version to be Wagtail<2.10,>=2.3 something I could help with?
I will later work on this but PR is also welcome!
- We need update
tox.ini
andtravis.yml
to test this package with new version of Wagtail. - Should change
install_requires
in setup.py - Should figure out why this package can not work with Wagtail 2.10 (I guess need make some low-level API change)
Thx.
Thanks for the response!
If I have time I will shoot for a PR, as for item 3. I have had no issues using wagtail-whoosh with 2.9 or 2.10 so far, are there any issues that you are immediately aware of that I should look at if I attempt to patch wagtail-whoosh for 2.10?
Thanks!
If you want to make it work with Wagtail 2.10, you can check wagtail_whoosh/backend.py
, I guess Wagtail changed some low-level API so the current wagtail-whoosh can not work with it.
Thx.
I think i figured at least one incompatibility out, wagtail 2.9+ adds phrase based searching.
Tests failed on test_phrase (tests.test_backend.TestWhooshSearchBackend)
throwing NotImplementedError: 'Phrase' is not supported by the whoosh search backend.
We will probably need to add conditionals to handle Phrase to _build_query_string
and build_database_filter
I spent some time messing around trying to add it but I ran out of time, I may get back to it later this week, otherwise, i hope i was able to help narrow something down haha.
Hej, thanks for your great work.
Are there plans to make it compatible with the latest wagtail version ?
That would be great.
Whoosh's way of searching for phrases when using its query language is double-quoting the terms. But when I add
if isinstance(query, Phrase):
return " \"{}\" ".format(query.query_string)
to WhooshSearchQueryCompiler._build_query_string
and run the tests, I get whoosh.query.qcore.QueryError: Phrase search: 'title' field has no positions
.
I think the reason is that Wagtail defines an AutocompleteField
and partial_match
on the title field (https://github.com/wagtail/wagtail/blob/571b9e1918861bcbe64a9005a4dc65f3a1fe7a15/wagtail/tests/search/models.py#L29), so it is indexed in WhooshSearchBackend._to_whoosh_field
using an NGRAMWORDS
whoosh field, which does not support the phrase
argument (https://whoosh.readthedocs.io/en/latest/api/fields.html#whoosh.fields.NGRAMWORDS) like NGRAM
or TEXT
do. This looks like this issue: django-haystack/django-haystack#632
Not sure how to fix it, though, as I don't know much about search engines. I suppose we need a fix either in Whoosh (support the phrase
argument) or maybe in Wagtail (skip or modify the test_phrase
test when using the wagtail-whoosh backend or handle this better like with supports_facet
).
Hi @michael-yin,
I love this package. Is there any chance to get it "officially" working again for newer Wagtail versions? How much effort would it be and can we pay you for that?
Warmest,
André