Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wagtail 2.10 compatability? #21

Open
DIGIREN opened this issue Aug 13, 2020 · 8 comments
Open

Wagtail 2.10 compatability? #21

DIGIREN opened this issue Aug 13, 2020 · 8 comments

Comments

@DIGIREN
Copy link

DIGIREN commented Aug 13, 2020

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?

@michael-yin
Copy link
Collaborator

@DIGIREN

I will later work on this but PR is also welcome!

  1. We need update tox.ini and travis.yml to test this package with new version of Wagtail.
  2. Should change install_requires in setup.py
  3. Should figure out why this package can not work with Wagtail 2.10 (I guess need make some low-level API change)

Thx.

@DIGIREN
Copy link
Author

DIGIREN commented Aug 14, 2020

@michael-yin

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!

@michael-yin
Copy link
Collaborator

@DIGIREN

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.

@DIGIREN
Copy link
Author

DIGIREN commented Aug 14, 2020

@michael-yin

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.

@michael-yin
Copy link
Collaborator

@DIGIREN

Thanks for your work!

I will leave this issue open and work on it later.

@glanzel
Copy link

glanzel commented Jan 14, 2021

Hej, thanks for your great work.
Are there plans to make it compatible with the latest wagtail version ?
That would be great.

@benoitvogel
Copy link

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).

@andre-fuchs
Copy link

andre-fuchs commented Jul 5, 2021

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é

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants