mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	server-ts: Port services/search/expressions/attribute_exists
This commit is contained in:
		
							parent
							
								
									7018cc77a3
								
							
						
					
					
						commit
						0df488667e
					
				@ -1,11 +1,19 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
const NoteSet = require('../note_set');
 | 
			
		||||
const becca = require('../../../becca/becca');
 | 
			
		||||
const Expression = require('./expression');
 | 
			
		||||
import NoteSet = require("../note_set");
 | 
			
		||||
import SearchContext = require("../search_context");
 | 
			
		||||
 | 
			
		||||
import becca = require('../../../becca/becca');
 | 
			
		||||
import Expression = require('./expression');
 | 
			
		||||
 | 
			
		||||
class AttributeExistsExp extends Expression {
 | 
			
		||||
    constructor(attributeType, attributeName, prefixMatch) {
 | 
			
		||||
 | 
			
		||||
    private attributeType: string;
 | 
			
		||||
    private attributeName: string;
 | 
			
		||||
    private isTemplateLabel: boolean;
 | 
			
		||||
    private prefixMatch: string;
 | 
			
		||||
 | 
			
		||||
    constructor(attributeType: string, attributeName: string, prefixMatch: string) {
 | 
			
		||||
        super();
 | 
			
		||||
 | 
			
		||||
        this.attributeType = attributeType;
 | 
			
		||||
@ -15,7 +23,7 @@ class AttributeExistsExp extends Expression {
 | 
			
		||||
        this.prefixMatch = prefixMatch;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    execute(inputNoteSet, executionContext, searchContext) {
 | 
			
		||||
    execute(inputNoteSet: NoteSet, executionContext: {}, searchContext: SearchContext) {
 | 
			
		||||
        const attrs = this.prefixMatch
 | 
			
		||||
            ? becca.findAttributesWithPrefix(this.attributeType, this.attributeName)
 | 
			
		||||
            : becca.findAttributes(this.attributeType, this.attributeName);
 | 
			
		||||
@ -40,4 +48,4 @@ class AttributeExistsExp extends Expression {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = AttributeExistsExp;
 | 
			
		||||
export = AttributeExistsExp;
 | 
			
		||||
@ -9,7 +9,7 @@ const DescendantOfExp = require('../expressions/descendant_of.js');
 | 
			
		||||
const ParentOfExp = require('../expressions/parent_of.js');
 | 
			
		||||
const RelationWhereExp = require('../expressions/relation_where.js');
 | 
			
		||||
const PropertyComparisonExp = require('../expressions/property_comparison.js');
 | 
			
		||||
const AttributeExistsExp = require('../expressions/attribute_exists.js');
 | 
			
		||||
const AttributeExistsExp = require('../expressions/attribute_exists');
 | 
			
		||||
const LabelComparisonExp = require('../expressions/label_comparison.js');
 | 
			
		||||
const NoteFlatTextExp = require('../expressions/note_flat_text.js');
 | 
			
		||||
const NoteContentFulltextExp = require('../expressions/note_content_fulltext.js');
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user