Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
server-ts: Port services/search/expressions/relation_where
Elian Doranf5b690d088c1
diff --git a/src/services/search/expressions/relation_where.js b/src/services/search/expressions/relation_where.tssimilarity index 72%rename from src/services/search/expressions/relation_where.jsrename to src/services/search/expressions/relation_where.tsindex 33d4e8f596..9f33dcecf7 100644--- a/src/services/search/expressions/relation_where.js+++ b/src/services/search/expressions/relation_where.ts@@ -1,18 +1,22 @@"use strict";-const Expression = require('./expression');-const NoteSet = require('../note_set');-const becca = require('../../../becca/becca');+import Expression = require('./expression');+import NoteSet = require('../note_set');+import becca = require('../../../becca/becca');+import SearchContext = require('../search_context');class RelationWhereExp extends Expression {- constructor(relationName, subExpression) {+ private relationName: string;+ private subExpression: Expression;++ constructor(relationName: string, subExpression: Expression) {super();this.relationName = relationName;this.subExpression = subExpression;}- execute(inputNoteSet, executionContext, searchContext) {+ execute(inputNoteSet: NoteSet, executionContext: {}, searchContext: SearchContext) {const candidateNoteSet = new NoteSet();for (const attr of becca.findAttributes('relation', this.relationName)) {@@ -38,4 +42,4 @@ class RelationWhereExp extends Expression {}}-module.exports = RelationWhereExp;+export = RelationWhereExp;diff --git a/src/services/search/services/parse.js b/src/services/search/services/parse.jsindex 28d6b6afec..869046236e 100644--- a/src/services/search/services/parse.js+++ b/src/services/search/services/parse.js@@ -7,7 +7,7 @@ const NotExp = require('../expressions/not');const ChildOfExp = require('../expressions/child_of');const DescendantOfExp = require('../expressions/descendant_of');const ParentOfExp = require('../expressions/parent_of');-const RelationWhereExp = require('../expressions/relation_where.js');+const RelationWhereExp = require('../expressions/relation_where');const PropertyComparisonExp = require('../expressions/property_comparison.js');const AttributeExistsExp = require('../expressions/attribute_exists');const LabelComparisonExp = require('../expressions/label_comparison');