Skip to content

Commit a580023

Browse files
committed
adds fq search query param to client
1 parent 2679365 commit a580023

3 files changed

Lines changed: 24 additions & 19 deletions

File tree

src/@types/searchOptions.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
export interface DataverseSearchOptions {
2-
q: string,
3-
subtree?: string,
4-
start?: number,
5-
type?: SearchType,
6-
sort?: SearchSortAttribute,
7-
order?: SearchOrder,
8-
per_page?: number,
9-
show_entity_ids?: boolean,
2+
q: string
3+
subtree?: string
4+
start?: number
5+
type?: SearchType
6+
sort?: SearchSortAttribute
7+
order?: SearchOrder
8+
per_page?: number
9+
show_entity_ids?: boolean
1010
show_relevance?: boolean
11+
fq?: string
1112
}
1213

1314
export interface SearchOptions {
14-
query: string,
15-
dataverseAlias?: string,
16-
startPosition?: number,
17-
type?: SearchType,
18-
sortAttribute?: SearchSortAttribute,
19-
order?: SearchOrder,
20-
itemsPerPage?: number,
21-
showEntityIds?: boolean,
15+
query: string
16+
dataverseAlias?: string
17+
startPosition?: number
18+
type?: SearchType
19+
sortAttribute?: SearchSortAttribute
20+
order?: SearchOrder
21+
itemsPerPage?: number
22+
showEntityIds?: boolean
2223
showRelevance?: boolean
24+
fq?: string
2325
}
2426

2527
export enum SearchType {

src/dataverseClient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ export class DataverseClient {
201201
order: options.order,
202202
'per_page': options.itemsPerPage,
203203
'show_entity_ids': options.showEntityIds,
204-
'show_relevance': options.showRelevance
204+
'show_relevance': options.showRelevance,
205+
fq: options.fq
205206
}
206207
}
207208
}

test/dataverseClient.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ describe('DataverseClient', () => {
372372
it('should call axios with expected url and options', async () => {
373373
const query = random.word()
374374
const type: SearchType = SearchType.DATASET
375+
const fq = 'publicationStatus:Published'
375376
const expectedOptions: DataverseSearchOptions = {
376377
q: query,
377378
subtree: undefined,
@@ -381,9 +382,10 @@ describe('DataverseClient', () => {
381382
order: undefined,
382383
'per_page': undefined,
383384
'show_entity_ids': undefined,
384-
'show_relevance': undefined
385+
'show_relevance': undefined,
386+
fq: fq
385387
}
386-
await client.search({ query, type })
388+
await client.search({ query, type, fq })
387389

388390
assert.calledOnce(axiosGetStub)
389391
assert.calledWithExactly(axiosGetStub, `${host}/api/search`, {

0 commit comments

Comments
 (0)