Skip to content

Commit

Permalink
Keep _q as is for now (but add _qualifier param)
Browse files Browse the repository at this point in the history
This allows the labels in #1186 to work as inteded. We need to sync what the Libris XL API needs first before we do something more.
  • Loading branch information
johanbissemattsson committed Dec 17, 2024
1 parent a08e65b commit 7058bc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import getEditedPartEntries from './getEditedPartEntries';

describe('getEditedPartEntries', () => {
it('narrows down search query when editing qualifier parts', () => {
expect(getEditedPartEntries('hello title:"hej"', 16)).toEqual([['_q', 'title:"hej"']]);
expect(getEditedPartEntries('hello title:"hej"', 16)).toEqual([['_qualifier', 'title:"hej"']]);
});
it('keeps query as is when editing year qualifiers', () => {
expect(getEditedPartEntries('hello ÅR:2024', 13)).toEqual([]);
});
it('narrows down search query by base class for query codes', () => {
expect(getEditedPartEntries('astrid lindgren subject:"winter"', 27)).toEqual([
['_q', `"rdf:type":Topic "winter"`],
['_qualifier', `"rdf:type":Topic "winter"`],
['min-reverseLinks.totalItems', '1']
]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ function getEditedPartEntries(query: string, cursor: number): [string, string][]

if (baseClass) {
return [
['_q', `"rdf:type":${baseClass} ${qualifierValue}`],
['_qualifier', `"rdf:type":${baseClass} ${qualifierValue}`],
['min-reverseLinks.totalItems', '1'] // ensure results are linked/used atleast once
];
}

return [['_q', qualifierKey + qualifierOperator + qualifierValue]];
return [['_qualifier', qualifierKey + qualifierOperator + qualifierValue]];
}

/**
Expand Down

0 comments on commit 7058bc1

Please sign in to comment.