mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Desktop: Fix bug with quotes when searching (#3735)
This commit is contained in:
parent
5f410e80e6
commit
4b377589aa
@ -108,6 +108,9 @@ describe('filterParser should be correct filter for keyword', () => {
|
||||
|
||||
searchString = 'tag:bl*sphemy';
|
||||
expect(filterParser(searchString)).toContain(makeTerm('tag', 'bl%sphemy', false));
|
||||
|
||||
searchString = 'tag:"space travel"';
|
||||
expect(filterParser(searchString)).toContain(makeTerm('tag', 'space travel', false));
|
||||
});
|
||||
|
||||
it('wildcard notebooks', () => {
|
||||
|
@ -268,7 +268,7 @@ describe('services_SearchFilter', function() {
|
||||
|
||||
await Tag.setNoteTagsByTitles(n1.id, ['tag1', 'tag2']);
|
||||
await Tag.setNoteTagsByTitles(n2.id, ['tag2', 'tag3']);
|
||||
await Tag.setNoteTagsByTitles(n3.id, ['tag3', 'tag4']);
|
||||
await Tag.setNoteTagsByTitles(n3.id, ['tag3', 'tag4', 'space travel']);
|
||||
|
||||
await engine.syncTables();
|
||||
|
||||
@ -304,6 +304,10 @@ describe('services_SearchFilter', function() {
|
||||
expect(rows.length).toBe(2);
|
||||
expect(ids(rows)).toContain(n1.id);
|
||||
expect(ids(rows)).toContain(n3.id);
|
||||
|
||||
rows = await engine.search('tag:"space travel"');
|
||||
expect(rows.length).toBe(1);
|
||||
expect(ids(rows)).toContain(n3.id);
|
||||
}));
|
||||
|
||||
it('should support filtering by notebook', asyncTest(async () => {
|
||||
|
@ -82,7 +82,7 @@ const parseQuery = (query: string): Term[] => {
|
||||
}
|
||||
|
||||
if (name === 'tag' || name === 'notebook' || name === 'resource' || name === 'sourceurl') {
|
||||
result.push({ name, value: value.replace(/[*]/g, '%'), negated }); // for wildcard search
|
||||
result.push({ name, value: trimQuotes(value.replace(/[*]/g, '%')), negated }); // for wildcard search
|
||||
} else if (name === 'title' || name === 'body') {
|
||||
// Trim quotes since we don't support phrase query here
|
||||
// eg. Split title:"hello world" to title:hello title:world
|
||||
|
Loading…
Reference in New Issue
Block a user