diff --git a/packages/datagateway-common/src/api/index.test.tsx b/packages/datagateway-common/src/api/index.test.tsx index a9702869d..01d349039 100644 --- a/packages/datagateway-common/src/api/index.test.tsx +++ b/packages/datagateway-common/src/api/index.test.tsx @@ -395,7 +395,7 @@ describe('generic api functions', () => { }); expect(pushSpy).toHaveBeenCalledWith({ - search: '?semanticSearch=false', + search: '?', }); }); }); @@ -435,7 +435,7 @@ describe('generic api functions', () => { }); expect(pushSpy).toHaveBeenCalledWith({ - search: '?semanticSearch=false', + search: '?', }); }); }); @@ -481,7 +481,7 @@ describe('generic api functions', () => { }); expect(pushSpy).toHaveBeenCalledWith({ - search: '?semanticSearch=false', + search: '?', }); }); }); @@ -643,7 +643,7 @@ describe('generic api functions', () => { expect(replaceSpy).toHaveBeenCalledWith({ search: - '?semanticSearch=false&filters=%7B%22name%22%3A%7B%22value%22%3A%22test%22%2C%22type%22%3A%22include%22%7D%2C%22title%22%3A%7B%22value%22%3A%22test2%22%2C%22type%22%3A%22include%22%7D%7D', + '?filters=%7B%22name%22%3A%7B%22value%22%3A%22test%22%2C%22type%22%3A%22include%22%7D%2C%22title%22%3A%7B%22value%22%3A%22test2%22%2C%22type%22%3A%22include%22%7D%7D', }); }); @@ -665,7 +665,7 @@ describe('generic api functions', () => { }); expect(replaceSpy).toHaveBeenCalledWith({ - search: '?semanticSearch=false&sort=%7B%22name%22%3A%22asc%22%7D', + search: '?sort=%7B%22name%22%3A%22asc%22%7D', }); }); @@ -794,7 +794,7 @@ describe('generic api functions', () => { result.current(null); }); - expect(pushSpy).toHaveBeenLastCalledWith('?semanticSearch=false'); + expect(pushSpy).toHaveBeenLastCalledWith('?'); }); }); @@ -822,7 +822,7 @@ describe('generic api functions', () => { result.current(null); }); - expect(pushSpy).toHaveBeenLastCalledWith('?semanticSearch=false'); + expect(pushSpy).toHaveBeenLastCalledWith('?'); }); }); }); diff --git a/packages/datagateway-dataview/cypress/e2e/table/pageContainer.cy.ts b/packages/datagateway-dataview/cypress/e2e/table/pageContainer.cy.ts index e269652bc..8b1a5ad7e 100644 --- a/packages/datagateway-dataview/cypress/e2e/table/pageContainer.cy.ts +++ b/packages/datagateway-dataview/cypress/e2e/table/pageContainer.cy.ts @@ -26,7 +26,7 @@ describe('PageContainer Component', () => { cy.get('[aria-rowindex="1"] [aria-colindex="4"]').contains('24'); cy.get('[data-testid="clear-filters-button"]').click(); - cy.url().should('eq', `${url}?semanticSearch=false`); + cy.url().should('eq', `${url}?`); }); }); diff --git a/packages/datagateway-dataview/src/page/pageContainer.component.test.tsx b/packages/datagateway-dataview/src/page/pageContainer.component.test.tsx index f983d7a2e..ef820b788 100644 --- a/packages/datagateway-dataview/src/page/pageContainer.component.test.tsx +++ b/packages/datagateway-dataview/src/page/pageContainer.component.test.tsx @@ -244,7 +244,7 @@ describe('PageContainer - Tests', () => { expect( await screen.findByRole('button', { name: 'app.clear_filters' }) ).toBeDisabled(); - expect(history.location.search).toEqual('?semanticSearch=false'); + expect(history.location.search).toEqual('?'); }); it('display clear filters button and clear for filters onClick (/my-data/DLS)', async () => { diff --git a/packages/datagateway-dataview/src/views/card/datasetCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/datasetCardView.component.test.tsx index a412e3d7a..ffc7bb947 100644 --- a/packages/datagateway-dataview/src/views/card/datasetCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/datasetCardView.component.test.tsx @@ -198,7 +198,7 @@ describe('Dataset - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -223,7 +223,7 @@ describe('Dataset - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/card/dls/dlsDatasetsCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/dls/dlsDatasetsCardView.component.test.tsx index 5349b2333..195faa69d 100644 --- a/packages/datagateway-dataview/src/views/card/dls/dlsDatasetsCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/dls/dlsDatasetsCardView.component.test.tsx @@ -111,7 +111,7 @@ describe('DLS Datasets - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -136,7 +136,7 @@ describe('DLS Datasets - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/card/dls/dlsProposalsCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/dls/dlsProposalsCardView.component.test.tsx index 1044146b4..8ac971ce5 100644 --- a/packages/datagateway-dataview/src/views/card/dls/dlsProposalsCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/dls/dlsProposalsCardView.component.test.tsx @@ -100,21 +100,21 @@ describe('DLS Proposals - Card View', () => { await user.type(filter, 'test'); expect(history.location.search).toBe( - `?semanticSearch=false&filters=${encodeURIComponent( + `?filters=${encodeURIComponent( '{"title":{"value":"test","type":"include"}}' )}` ); await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('uses default sort', () => { renderComponent(); expect(history.length).toBe(1); expect(history.location.search).toBe( - `?semanticSearch=false&sort=${encodeURIComponent('{"title":"asc"}')}` + `?sort=${encodeURIComponent('{"title":"asc"}')}` ); }); diff --git a/packages/datagateway-dataview/src/views/card/dls/dlsVisitsCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/dls/dlsVisitsCardView.component.test.tsx index 9212acda4..b1c518cb3 100644 --- a/packages/datagateway-dataview/src/views/card/dls/dlsVisitsCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/dls/dlsVisitsCardView.component.test.tsx @@ -114,7 +114,7 @@ describe('DLS Visits - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -139,7 +139,7 @@ describe('DLS Visits - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/card/investigationCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/investigationCardView.component.test.tsx index 59c76236d..0ce0a0f5d 100644 --- a/packages/datagateway-dataview/src/views/card/investigationCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/investigationCardView.component.test.tsx @@ -244,7 +244,7 @@ describe('Investigation - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -268,7 +268,7 @@ describe('Investigation - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/card/isis/isisDataPublicationsCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/isis/isisDataPublicationsCardView.component.test.tsx index 206140fd5..f163af5d5 100644 --- a/packages/datagateway-dataview/src/views/card/isis/isisDataPublicationsCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/isis/isisDataPublicationsCardView.component.test.tsx @@ -154,14 +154,14 @@ describe('ISIS Data Publication - Card View', () => { await user.type(filter, 'Test'); expect(history.location.search).toBe( - `?semanticSearch=false&filters=${encodeURIComponent( + `?filters=${encodeURIComponent( '{"title":{"value":"Test","type":"include"}}' )}` ); await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); jest.useRealTimers(); }); @@ -183,13 +183,13 @@ describe('ISIS Data Publication - Card View', () => { await user.type(filterInput, '2019-08-06'); expect(history.location.search).toBe( - `?semanticSearch=false&filters=${encodeURIComponent( + `?filters=${encodeURIComponent( '{"publicationDate":{"endDate":"2019-08-06"}}' )}` ); await user.clear(filterInput); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); @@ -206,7 +206,7 @@ describe('ISIS Data Publication - Card View', () => { ); expect(history.location.search).toBe( - `?semanticSearch=false&sort=${encodeURIComponent('{"title":"asc"}')}` + `?sort=${encodeURIComponent('{"title":"asc"}')}` ); }); }); diff --git a/packages/datagateway-dataview/src/views/card/isis/isisDatasetsCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/isis/isisDatasetsCardView.component.test.tsx index 25f555456..e1992b677 100644 --- a/packages/datagateway-dataview/src/views/card/isis/isisDatasetsCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/isis/isisDatasetsCardView.component.test.tsx @@ -146,7 +146,7 @@ describe('ISIS Datasets - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -171,7 +171,7 @@ describe('ISIS Datasets - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/card/isis/isisFacilityCyclesCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/isis/isisFacilityCyclesCardView.component.test.tsx index da4a696de..6e8cf13f1 100644 --- a/packages/datagateway-dataview/src/views/card/isis/isisFacilityCyclesCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/isis/isisFacilityCyclesCardView.component.test.tsx @@ -111,7 +111,7 @@ describe('ISIS Facility Cycles - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -136,7 +136,7 @@ describe('ISIS Facility Cycles - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/card/isis/isisInstrumentsCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/isis/isisInstrumentsCardView.component.test.tsx index 426133e7b..a5ec3e787 100644 --- a/packages/datagateway-dataview/src/views/card/isis/isisInstrumentsCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/isis/isisInstrumentsCardView.component.test.tsx @@ -129,7 +129,7 @@ describe('ISIS Instruments - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('uses default sort', () => { diff --git a/packages/datagateway-dataview/src/views/card/isis/isisInvestigationsCardView.component.test.tsx b/packages/datagateway-dataview/src/views/card/isis/isisInvestigationsCardView.component.test.tsx index 434f72075..f1f45cd96 100644 --- a/packages/datagateway-dataview/src/views/card/isis/isisInvestigationsCardView.component.test.tsx +++ b/packages/datagateway-dataview/src/views/card/isis/isisInvestigationsCardView.component.test.tsx @@ -263,7 +263,7 @@ describe('ISIS Investigations - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -288,7 +288,7 @@ describe('ISIS Investigations - Card View', () => { await user.clear(filter); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/datafileTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/datafileTable.component.test.tsx index 53a3baa81..af52f7803 100644 --- a/packages/datagateway-dataview/src/views/table/datafileTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/datafileTable.component.test.tsx @@ -227,7 +227,7 @@ describe('Datafile table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { applyDatePickerWorkaround(); @@ -248,7 +248,7 @@ describe('Datafile table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/datasetTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/datasetTable.component.test.tsx index 8fc150ac5..2f5e17041 100644 --- a/packages/datagateway-dataview/src/views/table/datasetTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/datasetTable.component.test.tsx @@ -235,7 +235,7 @@ describe('Dataset table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -257,7 +257,7 @@ describe('Dataset table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/dls/dlsDatafilesTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/dls/dlsDatafilesTable.component.test.tsx index d5dbdab76..cc8541a74 100644 --- a/packages/datagateway-dataview/src/views/table/dls/dlsDatafilesTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/dls/dlsDatafilesTable.component.test.tsx @@ -193,7 +193,7 @@ describe('DLS datafiles table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -217,7 +217,7 @@ describe('DLS datafiles table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); @@ -239,7 +239,7 @@ describe('DLS datafiles table component', () => { expect(history.length).toBe(2); expect(history.location.search).toBe( - `?semanticSearch=false&sort=${encodeURIComponent('{"name":"asc"}')}` + `?sort=${encodeURIComponent('{"name":"asc"}')}` ); }); diff --git a/packages/datagateway-dataview/src/views/table/dls/dlsDatasetsTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/dls/dlsDatasetsTable.component.test.tsx index 1971974d9..1befa62ad 100644 --- a/packages/datagateway-dataview/src/views/table/dls/dlsDatasetsTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/dls/dlsDatasetsTable.component.test.tsx @@ -198,7 +198,7 @@ describe('DLS Dataset table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -220,7 +220,7 @@ describe('DLS Dataset table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/dls/dlsMyDataTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/dls/dlsMyDataTable.component.test.tsx index 5a319caf5..36be1daae 100644 --- a/packages/datagateway-dataview/src/views/table/dls/dlsMyDataTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/dls/dlsMyDataTable.component.test.tsx @@ -226,7 +226,7 @@ describe('DLS MyData table component', () => { await user.clear(filterInput); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -246,7 +246,7 @@ describe('DLS MyData table component', () => { await user.clear(filterInput); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/dls/dlsProposalsTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/dls/dlsProposalsTable.component.test.tsx index 0377e7b37..10694201c 100644 --- a/packages/datagateway-dataview/src/views/table/dls/dlsProposalsTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/dls/dlsProposalsTable.component.test.tsx @@ -163,7 +163,7 @@ describe('DLS Proposals table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('uses default sort', () => { diff --git a/packages/datagateway-dataview/src/views/table/dls/dlsVisitsTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/dls/dlsVisitsTable.component.test.tsx index f84f2d215..ad62d5dca 100644 --- a/packages/datagateway-dataview/src/views/table/dls/dlsVisitsTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/dls/dlsVisitsTable.component.test.tsx @@ -205,7 +205,7 @@ describe('DLS Visits table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -227,7 +227,7 @@ describe('DLS Visits table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/investigationTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/investigationTable.component.test.tsx index f97276dc3..8e1326162 100644 --- a/packages/datagateway-dataview/src/views/table/investigationTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/investigationTable.component.test.tsx @@ -288,7 +288,7 @@ describe('Investigation table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -312,7 +312,7 @@ describe('Investigation table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/isis/isisDataPublicationsTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/isis/isisDataPublicationsTable.component.test.tsx index 6e340943c..82985e6cd 100644 --- a/packages/datagateway-dataview/src/views/table/isis/isisDataPublicationsTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/isis/isisDataPublicationsTable.component.test.tsx @@ -178,7 +178,7 @@ describe('ISIS Data Publication table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -202,7 +202,7 @@ describe('ISIS Data Publication table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/isis/isisDatafilesTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/isis/isisDatafilesTable.component.test.tsx index 396756753..f07f1145c 100644 --- a/packages/datagateway-dataview/src/views/table/isis/isisDatafilesTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/isis/isisDatafilesTable.component.test.tsx @@ -229,7 +229,7 @@ describe('ISIS datafiles table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -251,7 +251,7 @@ describe('ISIS datafiles table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/isis/isisDatasetsTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/isis/isisDatasetsTable.component.test.tsx index 49fef6a13..811df19be 100644 --- a/packages/datagateway-dataview/src/views/table/isis/isisDatasetsTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/isis/isisDatasetsTable.component.test.tsx @@ -144,7 +144,7 @@ describe('ISIS Dataset table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -159,15 +159,13 @@ describe('ISIS Dataset table component', () => { await user.type(filterInput, '2019-08-06'); expect(history.location.search).toBe( - `?semanticSearch=false&filters=${encodeURIComponent( - '{"modTime":{"endDate":"2019-08-06"}}' - )}` + `?filters=${encodeURIComponent('{"modTime":{"endDate":"2019-08-06"}}')}` ); await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); @@ -176,9 +174,7 @@ describe('ISIS Dataset table component', () => { renderComponent(); expect(history.length).toBe(1); expect(history.location.search).toBe( - `?semanticSearch=false&sort=${encodeURIComponent( - '{"createTime":"desc"}' - )}` + `?sort=${encodeURIComponent('{"createTime":"desc"}')}` ); }); @@ -189,7 +185,7 @@ describe('ISIS Dataset table component', () => { expect(history.length).toBe(2); expect(history.location.search).toBe( - `?semanticSearch=false&sort=${encodeURIComponent('{"name":"asc"}')}` + `?sort=${encodeURIComponent('{"name":"asc"}')}` ); }); diff --git a/packages/datagateway-dataview/src/views/table/isis/isisFacilityCyclesTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/isis/isisFacilityCyclesTable.component.test.tsx index b0f005fc5..d3a03394a 100644 --- a/packages/datagateway-dataview/src/views/table/isis/isisFacilityCyclesTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/isis/isisFacilityCyclesTable.component.test.tsx @@ -166,7 +166,7 @@ describe('ISIS FacilityCycles table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -188,7 +188,7 @@ describe('ISIS FacilityCycles table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/isis/isisInstrumentsTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/isis/isisInstrumentsTable.component.test.tsx index 6e3eb7b65..ad6c75a9a 100644 --- a/packages/datagateway-dataview/src/views/table/isis/isisInstrumentsTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/isis/isisInstrumentsTable.component.test.tsx @@ -175,7 +175,7 @@ describe('ISIS Instruments table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('uses default sort', () => { diff --git a/packages/datagateway-dataview/src/views/table/isis/isisInvestigationsTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/isis/isisInvestigationsTable.component.test.tsx index ec54ced7e..ce12270f3 100644 --- a/packages/datagateway-dataview/src/views/table/isis/isisInvestigationsTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/isis/isisInvestigationsTable.component.test.tsx @@ -324,7 +324,7 @@ describe('ISIS Investigations table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -348,7 +348,7 @@ describe('ISIS Investigations table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-dataview/src/views/table/isis/isisMyDataTable.component.test.tsx b/packages/datagateway-dataview/src/views/table/isis/isisMyDataTable.component.test.tsx index 5a61cfaaf..978b1b67f 100644 --- a/packages/datagateway-dataview/src/views/table/isis/isisMyDataTable.component.test.tsx +++ b/packages/datagateway-dataview/src/views/table/isis/isisMyDataTable.component.test.tsx @@ -313,7 +313,7 @@ describe('ISIS MyData table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -337,7 +337,7 @@ describe('ISIS MyData table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-search/src/card/datasetSearchCardView.component.test.tsx b/packages/datagateway-search/src/card/datasetSearchCardView.component.test.tsx index 9e7c0ccf7..49f1345c2 100644 --- a/packages/datagateway-search/src/card/datasetSearchCardView.component.test.tsx +++ b/packages/datagateway-search/src/card/datasetSearchCardView.component.test.tsx @@ -203,7 +203,7 @@ describe('Dataset - Card View', () => { }) ); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); @@ -216,7 +216,7 @@ describe('Dataset - Card View', () => { ); expect(history.location.search).toBe( - `?semanticSearch=false&sort=${encodeURIComponent('{"name":"asc"}')}` + `?sort=${encodeURIComponent('{"name":"asc"}')}` ); }); diff --git a/packages/datagateway-search/src/card/investigationSearchCardView.component.test.tsx b/packages/datagateway-search/src/card/investigationSearchCardView.component.test.tsx index 058185636..7c8b127a0 100644 --- a/packages/datagateway-search/src/card/investigationSearchCardView.component.test.tsx +++ b/packages/datagateway-search/src/card/investigationSearchCardView.component.test.tsx @@ -176,7 +176,7 @@ describe('Investigation - Card View', () => { ); await user.clear(filterInput); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -196,9 +196,7 @@ describe('Investigation - Card View', () => { ); expect(history.location.search).toBe( - `?semanticSearch=false&filters=${encodeURIComponent( - '{"endDate":{"endDate":"2019-08-06"}}' - )}` + `?filters=${encodeURIComponent('{"endDate":{"endDate":"2019-08-06"}}')}` ); await user.clear( @@ -207,7 +205,7 @@ describe('Investigation - Card View', () => { }) ); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); @@ -222,7 +220,7 @@ describe('Investigation - Card View', () => { ); expect(history.location.search).toBe( - `?semanticSearch=false&sort=${encodeURIComponent('{"title":"asc"}')}` + `?sort=${encodeURIComponent('{"title":"asc"}')}` ); }); diff --git a/packages/datagateway-search/src/search/checkBoxes.component.test.tsx b/packages/datagateway-search/src/search/checkBoxes.component.test.tsx index ae890697e..9aa1ee062 100644 --- a/packages/datagateway-search/src/search/checkBoxes.component.test.tsx +++ b/packages/datagateway-search/src/search/checkBoxes.component.test.tsx @@ -165,6 +165,6 @@ describe('Checkbox component tests', () => { }) ); - expect(pushSpy).toHaveBeenCalledWith('?semanticSearch=false'); + expect(pushSpy).toHaveBeenCalledWith('?'); }); }); diff --git a/packages/datagateway-search/src/searchPageContainer.component.tsx b/packages/datagateway-search/src/searchPageContainer.component.tsx index 2e7ee53b9..6f75e5cfa 100644 --- a/packages/datagateway-search/src/searchPageContainer.component.tsx +++ b/packages/datagateway-search/src/searchPageContainer.component.tsx @@ -276,7 +276,8 @@ const SearchPageContainer: React.FC = ( const [searchType, setSearchType] = React.useState( searchTypeURL ?? 'lucene' ); - const [searchOnNextRender, setSearchOnNextRender] = React.useState(false); + const [luceneSearchOnNextRender, setLuceneSearchOnNextRender] = + React.useState(false); const handleSearchTextChange = (searchText: string): void => { setSearchText(searchText); @@ -354,7 +355,7 @@ const SearchPageContainer: React.FC = ( if (searchType === 'lucene') { clearMLSearchType(); - setSearchOnNextRender(true); + setLuceneSearchOnNextRender(true); localStorage.removeItem('investigationFilters'); localStorage.removeItem('datasetFilters'); @@ -371,6 +372,9 @@ const SearchPageContainer: React.FC = ( if (queryParams.page !== null) replacePage(null); if (queryParams.results !== null) replaceResults(null); } else { + setInvestigationTab(false); + setDatafileTab(false); + setDatasetTab(false); pushMLSearchType(searchType); } }, [ @@ -386,17 +390,39 @@ const SearchPageContainer: React.FC = ( replaceSorts, replacePage, replaceResults, + setInvestigationTab, + setDatafileTab, + setDatasetTab, pushMLSearchType, ]); React.useEffect(() => { - if (searchOnNextRender) { - setInvestigationTab(true); - - setSearchOnNextRender(false); + if (luceneSearchOnNextRender) { + if (dataset) { + // Fetch lucene datasets + searchDatasets(); + } + + if (datafile) { + // Fetch lucene datafiles + searchDatafiles(); + } + if (investigation) { + // Fetch lucene investigations + searchInvestigations(); + } + + if (dataset || datafile || investigation) { + // Set the appropriate tabs. + setDatafileTab(datafile); + setDatasetTab(dataset); + setInvestigationTab(investigation); + } + + setLuceneSearchOnNextRender(false); } }, [ - searchOnNextRender, + luceneSearchOnNextRender, dataset, datafile, investigation, @@ -415,7 +441,7 @@ const SearchPageContainer: React.FC = ( queryParams.startDate || queryParams.endDate ) - setSearchOnNextRender(true); + setLuceneSearchOnNextRender(true); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -423,7 +449,7 @@ const SearchPageContainer: React.FC = ( if (searchTextURL !== searchText) { //Ensure search text is assigned from the URL setSearchText(searchTextURL); - setSearchOnNextRender(true); + setLuceneSearchOnNextRender(true); } //Want to search whenever the search text in the URL changes so that clicking a react-router link also initiates the search @@ -529,7 +555,7 @@ const SearchPageContainer: React.FC = ( )} - {requestReceived && ( + {requestReceived && !isMLSearchType(searchTypeURL) && (
{ await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -297,7 +297,7 @@ describe('Datafile search table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-search/src/table/datasetSearchTable.component.test.tsx b/packages/datagateway-search/src/table/datasetSearchTable.component.test.tsx index 5bee41b69..9a640476e 100644 --- a/packages/datagateway-search/src/table/datasetSearchTable.component.test.tsx +++ b/packages/datagateway-search/src/table/datasetSearchTable.component.test.tsx @@ -342,7 +342,7 @@ describe('Dataset table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -364,7 +364,7 @@ describe('Dataset table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); }); diff --git a/packages/datagateway-search/src/table/investigationSearchTable.component.test.tsx b/packages/datagateway-search/src/table/investigationSearchTable.component.test.tsx index 257f26c9d..54714ebbb 100644 --- a/packages/datagateway-search/src/table/investigationSearchTable.component.test.tsx +++ b/packages/datagateway-search/src/table/investigationSearchTable.component.test.tsx @@ -416,7 +416,7 @@ describe('Investigation Search Table component', () => { await user.clear(filterInput); expect(history.length).toBe(6); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); }); it('updates filter query params on date filter', async () => { @@ -438,7 +438,7 @@ describe('Investigation Search Table component', () => { await user.clear(filterInput); expect(history.length).toBe(3); - expect(history.location.search).toBe('?semanticSearch=false'); + expect(history.location.search).toBe('?'); cleanupDatePickerWorkaround(); });