Skip to content

Commit

Permalink
LWS-213: Change default limit of results to 20 (#1076)
Browse files Browse the repository at this point in the history
* Change default limit of results to 20

* Update changelog

* Update en.md

* Update sv.md

---------

Co-authored-by: Kalle Wåhlin <[email protected]>
  • Loading branch information
johanbissemattsson and kwahlin authored Jun 27, 2024
1 parent 5175695 commit 17c762c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 19 deletions.
6 changes: 3 additions & 3 deletions lxl-web/src/lib/utils/addDefaultSearchParams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('addDefaultSearchParams', () => {
expect(addDefaultSearchParams(new URLSearchParams())).toStrictEqual(
new URLSearchParams([
['_q', '*'],
['_limit', '10'],
['_limit', '20'],
['_offset', '0'],
['_sort', '']
])
Expand All @@ -16,7 +16,7 @@ describe('addDefaultSearchParams', () => {
expect(addDefaultSearchParams(new URLSearchParams([['_q', 'test']]))).toStrictEqual(
new URLSearchParams([
['_q', 'test'],
['_limit', '10'],
['_limit', '20'],
['_offset', '0'],
['_sort', '']
])
Expand All @@ -27,7 +27,7 @@ describe('addDefaultSearchParams', () => {
new URLSearchParams([
['_offset', '30'],
['_q', '*'],
['_limit', '10'],
['_limit', '20'],
['_sort', '']
])
);
Expand Down
2 changes: 1 addition & 1 deletion lxl-web/src/lib/utils/addDefaultSearchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function addDefaultSearchParams(searchParams: URLSearchParams): URLSearchParams
params.set('_q', '*');
}
if (!params.has('_limit')) {
params.set('_limit', '10');
params.set('_limit', '20');
}
if (!params.has('_offset')) {
params.set('_offset', '0');
Expand Down
4 changes: 2 additions & 2 deletions lxl-web/src/lib/utils/http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ describe('relativize', () => {
);
});
it('removes the opening slash from a relative path', () => {
expect(relativizeUrl('/find?q=*&@type=Work&_limit=10')).toStrictEqual(
'find?q=*&@type=Work&_limit=10'
expect(relativizeUrl('/find?q=*&@type=Work&_limit=20')).toStrictEqual(
'find?q=*&@type=Work&_limit=20'
);
});
});
3 changes: 2 additions & 1 deletion lxl-web/src/routes/(app)/[[lang=lang]]/help/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Here we will continuously provide information about newly added features and pla

### 2024-06-27

- Change default number of hits per page to 20
- Added search on result list for people and subjects
- Hide labels for free text queries and add quotes instead
- Fix bug which prevented closing of initially opened holdings modal
- Bug fixes

### 2024-06-12

Expand Down
11 changes: 6 additions & 5 deletions lxl-web/src/routes/(app)/[[lang=lang]]/help/sv.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Här kommer vi kontinuerligt berätta om nytillkomna funktioner och planerad utv

### 2024-06-27

- Ändra antalet sökträffar per sida till 20
- Dölj etikett för fritextsökningar och lägg till citattecken istället
- Rätta bugg som förhindrade stängning av beståndsmodal
- Buggrättningar
- Stöd för sök i träfflistan för personer och ämnen

### 2024-06-12
Expand Down Expand Up @@ -103,19 +104,19 @@ Här följer några exempel som går att skriva in som sökfrågor direkt i sök

Engelska och franska verk som matchar sökfrasen "pippi långstrump" som givits ut efter år 2002:

[`pippi långstrump språk:(engelska OR franska) ÅR>2002`](<https://beta.libris-qa.kb.se/find?_i=pippi+l%C3%A5ngstrump&_q=pippi+l%C3%A5ngstrump+SPR%C3%85K:(engelska%20OR%20franska)&_limit=10&_x=advanced>)
[`pippi långstrump språk:(engelska OR franska) ÅR>2002`](<https://beta.libris-qa.kb.se/find?_i=pippi+l%C3%A5ngstrump&_q=pippi+l%C3%A5ngstrump+SPR%C3%85K:(engelska%20OR%20franska)&_limit=20&_x=advanced>)

Material med utgivning mellan 2010 och 2024, som är på svenska och har [drakar](https://id.kb.se/term/sao/Drakar) som ämne:

[`språk:svenska ÅR>2010 ÅR<=2024 ämne:"sao:Drakar"`](https://beta.libris-qa.kb.se/find?_i=&_q=SPR%C3%85K:svenska+%C3%85R%3E2010+%C3%85R%3C%3D2024+subject:%22sao:Drakar%22&_limit=10&_x=advanced)
[`språk:svenska ÅR>2010 ÅR<=2024 ämne:"sao:Drakar"`](https://beta.libris-qa.kb.se/find?_i=&_q=SPR%C3%85K:svenska+%C3%85R%3E2010+%C3%85R%3C%3D2024+subject:%22sao:Drakar%22&_limit=20&_x=advanced)

Fritextsökning på träd\*, där alla träffar ingår i bibliografin Digitaliserat Svenskt Tryck men som inte har verkstyp "Text":

[`träd* bibliografi:"sigel:DST" NOT typ:Text`](https://beta.libris-qa.kb.se/find?_i=tr%C3%A4d*&_q=tr%C3%A4d*+bibliography:%22sigel:DST%22+NOT+%22rdf:type%22:Text&_limit=10&_x=advanced)
[`träd* bibliografi:"sigel:DST" NOT typ:Text`](https://beta.libris-qa.kb.se/find?_i=tr%C3%A4d*&_q=tr%C3%A4d*+bibliography:%22sigel:DST%22+NOT+%22rdf:type%22:Text&_limit=20&_x=advanced)

Verk där Selma Lagerlöf är författare som har minst en upplaga som är en elektronisk resurs:

[`författare:"selma lagerlöf" "hasInstanceType":Electronic`](https://beta.libris-qa.kb.se/find?_i=&_q=F%C3%96RF:%22selma+lagerl%C3%B6f%22+hasInstanceType:Electronic&_limit=10&_x=advanced)
[`författare:"selma lagerlöf" "hasInstanceType":Electronic`](https://beta.libris-qa.kb.se/find?_i=&_q=F%C3%96RF:%22selma+lagerl%C3%B6f%22+hasInstanceType:Electronic&_limit=20&_x=advanced)

### Detaljvyn

Expand Down
2 changes: 1 addition & 1 deletion lxl-web/tests/error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test.describe('Missing resource page', () => {
test.describe('Find page with invalid query', () => {
test.beforeEach(async ({ page }) => {
await page.goto(
'/find?_i=geh&_q=test+unrecognizedproperty:%22https://id.kb.se/language/swe%22&_limit=10'
'/find?_i=geh&_q=test+unrecognizedproperty:%22https://id.kb.se/language/swe%22&_limit=20'
);
});
test('has expected h1', async ({ page }) => {
Expand Down
10 changes: 5 additions & 5 deletions lxl-web/tests/find.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';

test.beforeEach(async ({ page }) => {
await page.goto('/find?_q=d&_limit=10&_offset=0&_sort=&_i=d');
await page.goto('/find?_q=f&_limit=20&_offset=0&_sort=&_i=f');
});

test('should not have any detectable a11y issues', async ({ page }) => {
Expand All @@ -23,8 +23,8 @@ test('can change the language', async ({ page }) => {
await expect(page).toHaveURL(/\/en\/find/);
});

test('displays 10 search cards on a page', async ({ page }) => {
await expect(page.getByTestId('search-card')).toHaveCount(10);
test('displays 20 search cards on a page', async ({ page }) => {
await expect(page.getByTestId('search-card')).toHaveCount(20);
});

test('search card contains a link', async ({ page }) => {
Expand Down Expand Up @@ -63,9 +63,9 @@ test('has pagination', async ({ page }) => {
});

test('can paginate to next and previous', async ({ page }) => {
await expect(page).not.toHaveURL(/_offset=10/);
await expect(page).not.toHaveURL(/_offset=20/);
await page.getByTestId('pagination').getByLabel('Nästa sida').click();
await expect(page).toHaveURL(/_offset=10/);
await expect(page).toHaveURL(/_offset=20/);
await page.getByTestId('pagination').getByLabel('Föregående sida').click();
await expect(page).not.toHaveURL(/_offset=/);
});
2 changes: 1 addition & 1 deletion lxl-web/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ test('url is populated with correct searchparams', async ({ page }) => {
await page.getByTestId('main-search').click();
await page.getByTestId('main-search').fill('somephrase');
await page.getByTestId('main-search').press('Enter');
await expect(page).toHaveURL(/_q=somephrase&_limit=10&_offset=0&_sort=&_i=somephrase/);
await expect(page).toHaveURL(/_q=somephrase&_limit=20&_offset=0&_sort=&_i=somephrase/);
});

0 comments on commit 17c762c

Please sign in to comment.