small improvements and fixes

This commit is contained in:
zadam 2020-08-06 23:55:17 +02:00
parent f60af1f05e
commit 02cc52af66
12 changed files with 22 additions and 20 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
package-lock.json generated
View File

@ -3065,9 +3065,9 @@
} }
}, },
"electron": { "electron": {
"version": "10.0.0-beta.17", "version": "10.0.0-beta.19",
"resolved": "https://registry.npmjs.org/electron/-/electron-10.0.0-beta.17.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-10.0.0-beta.19.tgz",
"integrity": "sha512-ImDabQ8RwFq4b15qoZndukJLbel+Kg0vsBqXZ9S41NkoDPRbmHTK/MpIsB8KYApqCceqyOZYANoDYrkbB7QO2g==", "integrity": "sha512-UHpCyGfb+tkiJutNLNhH0qm2hELw8zY1g3+kpdH0OFPyMfzvJHQk6+mCz9VzWZNqGGnEpXryY5zQ0Ou/eoMH4A==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",

View File

@ -76,7 +76,7 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.2", "cross-env": "7.0.2",
"electron": "10.0.0-beta.17", "electron": "10.0.0-beta.19",
"electron-builder": "22.8.0", "electron-builder": "22.8.0",
"electron-packager": "15.0.0", "electron-packager": "15.0.0",
"electron-rebuild": "1.11.0", "electron-rebuild": "1.11.0",

View File

@ -3,7 +3,7 @@
const sql = require('../../services/sql'); const sql = require('../../services/sql');
const protectedSessionService = require('../../services/protected_session'); const protectedSessionService = require('../../services/protected_session');
const noteService = require('../../services/notes'); const noteService = require('../../services/notes');
const noteCacheService = require('../../services/note_cache/note_cache.js'); const noteCacheService = require('../../services/note_cache/note_cache_service');
function getRecentChanges(req) { function getRecentChanges(req) {
const {ancestorNoteId} = req.params; const {ancestorNoteId} = req.params;

View File

@ -1,10 +1,10 @@
"use strict"; "use strict";
const repository = require('../../services/repository'); const repository = require('../../services/repository');
const noteCacheService = require('../../services/note_cache/note_cache.js'); const noteCacheService = require('../../services/note_cache/note_cache_service');
const log = require('../../services/log'); const log = require('../../services/log');
const scriptService = require('../../services/script'); const scriptService = require('../../services/script');
const searchService = require('../../services/search/services/search.js'); const searchService = require('../../services/search/services/search');
function searchNotes(req) { function searchNotes(req) {
const {count, results} = searchService.searchTrimmedNotes(req.params.searchString); const {count, results} = searchService.searchTrimmedNotes(req.params.searchString);

View File

@ -170,11 +170,11 @@ class Note {
} }
} }
this.flatTextCache += this.title; this.flatTextCache += this.title + ' ';
for (const attr of this.attributes) { for (const attr of this.attributes) {
// it's best to use space as separator since spaces are filtered from the search string by the tokenization into words // it's best to use space as separator since spaces are filtered from the search string by the tokenization into words
this.flatTextCache += (attr.type === 'label' ? '#' : '@') + attr.name; this.flatTextCache += ' ' + (attr.type === 'label' ? '#' : '@') + attr.name;
if (attr.value) { if (attr.value) {
this.flatTextCache += '=' + attr.value; this.flatTextCache += '=' + attr.value;
@ -182,6 +182,8 @@ class Note {
} }
this.flatTextCache = this.flatTextCache.toLowerCase(); this.flatTextCache = this.flatTextCache.toLowerCase();
console.log(this.flatTextCache);
} }
return this.flatTextCache; return this.flatTextCache;

View File

@ -18,7 +18,7 @@ const sql = require('./sql');
const log = require('./log'); const log = require('./log');
const parseFilters = require('./search/parse_filters.js'); const parseFilters = require('./search/parse_filters.js');
const buildSearchQuery = require('./build_search_query'); const buildSearchQuery = require('./build_search_query');
const noteCacheService = require('./note_cache/note_cache.js'); const noteCacheService = require('./note_cache/note_cache_service');
function searchForNotes(searchString) { function searchForNotes(searchString) {
const noteIds = searchForNoteIds(searchString); const noteIds = searchForNoteIds(searchString);

View File

@ -4,7 +4,7 @@ const Expression = require('./expression');
const NoteSet = require('../note_set'); const NoteSet = require('../note_set');
const noteCache = require('../../note_cache/note_cache'); const noteCache = require('../../note_cache/note_cache');
class NoteCacheFulltextExp extends Expression { class NoteCacheFlatTextExp extends Expression {
constructor(tokens) { constructor(tokens) {
super(); super();
@ -70,7 +70,7 @@ class NoteCacheFulltextExp extends Expression {
for (const note of candidateNotes) { for (const note of candidateNotes) {
// autocomplete should be able to find notes by their noteIds as well (only leafs) // autocomplete should be able to find notes by their noteIds as well (only leafs)
if (this.tokens.length === 1 && note.noteId === this.tokens[0]) { if (this.tokens.length === 1 && note.noteId.toLowerCase() === this.tokens[0]) {
searchDownThePath(note, [], []); searchDownThePath(note, [], []);
continue; continue;
} }
@ -134,4 +134,4 @@ class NoteCacheFulltextExp extends Expression {
} }
} }
module.exports = NoteCacheFulltextExp; module.exports = NoteCacheFlatTextExp;

View File

@ -10,7 +10,7 @@ const RelationWhereExp = require('../expressions/relation_where.js');
const PropertyComparisonExp = require('../expressions/property_comparison.js'); const PropertyComparisonExp = require('../expressions/property_comparison.js');
const AttributeExistsExp = require('../expressions/attribute_exists.js'); const AttributeExistsExp = require('../expressions/attribute_exists.js');
const LabelComparisonExp = require('../expressions/label_comparison.js'); const LabelComparisonExp = require('../expressions/label_comparison.js');
const NoteCacheFulltextExp = require('../expressions/note_cache_fulltext.js'); const NoteCacheFulltextExp = require('../expressions/note_cache_flat_text.js');
const NoteContentProtectedFulltextExp = require('../expressions/note_content_protected_fulltext.js'); const NoteContentProtectedFulltextExp = require('../expressions/note_content_protected_fulltext.js');
const NoteContentUnprotectedFulltextExp = require('../expressions/note_content_unprotected_fulltext.js'); const NoteContentUnprotectedFulltextExp = require('../expressions/note_content_unprotected_fulltext.js');
const OrderByAndLimitExp = require('../expressions/order_by_and_limit.js'); const OrderByAndLimitExp = require('../expressions/order_by_and_limit.js');