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

feat: add searchScore field to pages #320

Merged
merged 1 commit into from
May 1, 2023

Conversation

dopry
Copy link
Collaborator

@dopry dopry commented Mar 8, 2023

Add a searchScore property to the pages types.

@dopry dopry force-pushed the feat/searchScore branch 10 times, most recently from 614f5b9 to aaeb34d Compare March 10, 2023 16:49
self.assertEquals(page_data[5]["searchScore"], None)

@unittest.skipIf(
connection.vendor != "postgresql",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about MySQL? it should support scoring

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess what I am saying is this should be skipIf(connection.vendor == "sqlite") since below we have

        if connection.vendor != "sqlite":
            qs = qs.annotate_score("search_score")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not running mysql, so I don't know if the test would pass or fail or what search scores would be generated by it. The same with elastic search. My instinct says each search backend is going to return different scores and ordering. I feel like we should implement tests for each search backend as we implement testing support for that backend. Although setting this up to fail when a new search backend is added to our test matrix, would probably help ensure we don't overlook it when we add those. I was just focusing on the postgres case here. How do you think we should proceed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I thought about it, I agree with the test selection solely on sqlite. Although at some point in the future the test selection will need to consider both the search backend and database connection.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zerolab any other feedback on this, or can we work on getting it merged?

@dopry dopry force-pushed the feat/searchScore branch from aaeb34d to dd0923a Compare March 10, 2023 17:52
@dopry dopry force-pushed the feat/searchScore branch from dd0923a to 6e4ea7a Compare March 10, 2023 17:54
@zerolab zerolab merged commit 985a3e3 into torchbox:main May 1, 2023
@dopry dopry deleted the feat/searchScore branch May 2, 2023 14:12
@dopry
Copy link
Collaborator Author

dopry commented May 2, 2023

🎉

engAmirEng pushed a commit to engAmirEng/wagtail-grapple that referenced this pull request May 2, 2023
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

Successfully merging this pull request may close these issues.

2 participants