mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
All: Better handle search queries that include dashes
This commit is contained in:
parent
9e165fc7dc
commit
8c9a148e71
@ -254,4 +254,26 @@ describe('services_SearchEngine', function() {
|
||||
expect(engine.parseQuery('*').termCount).toBe(0);
|
||||
}));
|
||||
|
||||
it('should handle queries with special characters', asyncTest(async () => {
|
||||
let rows;
|
||||
|
||||
const testCases = [
|
||||
['did-not-match', 'did-not-match'],
|
||||
['does match', 'does match'],
|
||||
];
|
||||
|
||||
for (let i = 0; i < testCases.length; i++) {
|
||||
const t = testCases[i];
|
||||
const content = t[0];
|
||||
const query = t[1];
|
||||
|
||||
const n = await Note.save({ title: content });
|
||||
await engine.syncTables();
|
||||
rows = await engine.search(query);
|
||||
expect(rows.length).toBe(1);
|
||||
|
||||
await Note.delete(n.id);
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
@ -355,6 +355,7 @@ class SearchEngine {
|
||||
|
||||
async search(query) {
|
||||
query = this.normalizeText_(query);
|
||||
query = query.replace(/-/g, ' '); // https://github.com/laurent22/joplin/issues/1075#issuecomment-459258856
|
||||
|
||||
const st = scriptType(query);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user