Skip to content

Commit

Permalink
small improvements and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Aug 6, 2020
1 parent f60af1f commit 02cc52a
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions libraries/bootstrap/css/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libraries/bootstrap/css/bootstrap.min.css.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions libraries/bootstrap/js/bootstrap.bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libraries/bootstrap/js/bootstrap.bundle.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"devDependencies": {
"cross-env": "7.0.2",
"electron": "10.0.0-beta.17",
"electron": "10.0.0-beta.19",
"electron-builder": "22.8.0",
"electron-packager": "15.0.0",
"electron-rebuild": "1.11.0",
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/recent_changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const sql = require('../../services/sql');
const protectedSessionService = require('../../services/protected_session');
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) {
const {ancestorNoteId} = req.params;
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/search.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use strict";

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 scriptService = require('../../services/script');
const searchService = require('../../services/search/services/search.js');
const searchService = require('../../services/search/services/search');

function searchNotes(req) {
const {count, results} = searchService.searchTrimmedNotes(req.params.searchString);
Expand Down
6 changes: 4 additions & 2 deletions src/services/note_cache/entities/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,20 @@ class Note {
}
}

this.flatTextCache += this.title;
this.flatTextCache += this.title + ' ';

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
this.flatTextCache += (attr.type === 'label' ? '#' : '@') + attr.name;
this.flatTextCache += ' ' + (attr.type === 'label' ? '#' : '@') + attr.name;

if (attr.value) {
this.flatTextCache += '=' + attr.value;
}
}

this.flatTextCache = this.flatTextCache.toLowerCase();

console.log(this.flatTextCache);
}

return this.flatTextCache;
Expand Down
2 changes: 1 addition & 1 deletion src/services/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const sql = require('./sql');
const log = require('./log');
const parseFilters = require('./search/parse_filters.js');
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) {
const noteIds = searchForNoteIds(searchString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Expression = require('./expression');
const NoteSet = require('../note_set');
const noteCache = require('../../note_cache/note_cache');

class NoteCacheFulltextExp extends Expression {
class NoteCacheFlatTextExp extends Expression {
constructor(tokens) {
super();

Expand Down Expand Up @@ -70,7 +70,7 @@ class NoteCacheFulltextExp extends Expression {

for (const note of candidateNotes) {
// 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, [], []);
continue;
}
Expand Down Expand Up @@ -134,4 +134,4 @@ class NoteCacheFulltextExp extends Expression {
}
}

module.exports = NoteCacheFulltextExp;
module.exports = NoteCacheFlatTextExp;
2 changes: 1 addition & 1 deletion src/services/search/services/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const RelationWhereExp = require('../expressions/relation_where.js');
const PropertyComparisonExp = require('../expressions/property_comparison.js');
const AttributeExistsExp = require('../expressions/attribute_exists.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 NoteContentUnprotectedFulltextExp = require('../expressions/note_content_unprotected_fulltext.js');
const OrderByAndLimitExp = require('../expressions/order_by_and_limit.js');
Expand Down

0 comments on commit 02cc52a

Please sign in to comment.