-
-
Notifications
You must be signed in to change notification settings - Fork 79
Add support for join relations in facet and numeric filters #260
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
Open
OllieJennings
wants to merge
7
commits into
typesense:master
Choose a base branch
from
OllieJennings:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,456
−273
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9173b25
Add support for join relations in facet and numeric filters (#1)
Copilot d0110df
Add integration tests for joins functionality in testground (#2)
Copilot dd352f2
Refactor JOINED_RELATION_FILTER_REGEX to use static getter and improv…
Copilot 1d81ef9
Refactor: Check isExcluded first in _buildFacetFilterString ternary o…
Copilot 3285820
Merge in latest from typesense (#5)
OllieJennings 5010758
Merge branch 'typesense:master' into master
OllieJennings 28f6418
Group join filters by collection to fix Typesense query syntax (#6)
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| describe("Joins", () => { | ||
| beforeAll(require("./support/beforeAll"), 60 * 1000); | ||
|
|
||
| beforeEach(async () => { | ||
| return page.goto("http://localhost:3000/joins.html"); | ||
| }, 30 * 1000); | ||
|
|
||
| describe("when rendering the page", () => { | ||
| it("renders all products initially", async () => { | ||
| await expect(page).toMatchElement("#stats", { | ||
| text: "10 results found", | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe("when filtering by retailer (join facet)", () => { | ||
| it("filters products by Amazon retailer", async () => { | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=Amazon]"); | ||
| await expect(page).toMatchElement("#stats", { | ||
| text: "10 results found", | ||
| }); | ||
| }); | ||
|
|
||
| it("filters products by BestBuy retailer", async () => { | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=BestBuy]"); | ||
| await expect(page).toMatchElement("#stats", { | ||
| text: "5 results found", | ||
| }); | ||
| }); | ||
|
|
||
| it("filters products by Walmart retailer", async () => { | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=Walmart]"); | ||
| await expect(page).toMatchElement("#stats", { | ||
| text: "7 results found", | ||
| }); | ||
| }); | ||
|
|
||
| it("filters products by Target retailer", async () => { | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=Target]"); | ||
| await expect(page).toMatchElement("#stats", { | ||
| text: "6 results found", | ||
| }); | ||
| }); | ||
|
|
||
| it("filters products by multiple retailers", async () => { | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=Amazon]"); | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=BestBuy]"); | ||
| await expect(page).toMatchElement("#stats", { | ||
| text: "10 results found", | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe("when filtering by price range (join numeric)", () => { | ||
| it("filters products by price range using range input", async () => { | ||
| await expect(page).toFill("#price-range-input input[type=number]:first-of-type", "50"); | ||
| await expect(page).toFill("#price-range-input input[type=number]:last-of-type", "100"); | ||
| await page.keyboard.press("Enter"); | ||
|
|
||
| await page.waitForSelector("#stats", { visible: true }); | ||
|
|
||
| const statsText = await page.$eval("#stats", (el) => el.textContent); | ||
| expect(statsText).toMatch(/\d+ results? found/); | ||
| }); | ||
| }); | ||
|
|
||
| describe("when combining filters", () => { | ||
| it("filters products by retailer and price range", async () => { | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=Amazon]"); | ||
| await expect(page).toFill("#price-range-input input[type=number]:first-of-type", "20"); | ||
| await expect(page).toFill("#price-range-input input[type=number]:last-of-type", "50"); | ||
| await page.keyboard.press("Enter"); | ||
|
|
||
| await page.waitForSelector("#stats", { visible: true }); | ||
|
|
||
| const statsText = await page.$eval("#stats", (el) => el.textContent); | ||
| expect(statsText).toMatch(/\d+ results? found/); | ||
| }); | ||
| }); | ||
|
|
||
| describe("when clearing refinements", () => { | ||
| it("clears all filters and shows all products", async () => { | ||
| await expect(page).toClick("#retailer-list input[type=checkbox][value=Amazon]"); | ||
| await expect(page).toClick("#clear-refinements button"); | ||
| await expect(page).toMatchElement("#stats", { | ||
| text: "10 results found", | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.