mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	server-ts: Port services/search/expressions/label_comparison
This commit is contained in:
		
							parent
							
								
									acb31b621f
								
							
						
					
					
						commit
						571c9f544c
					
				| @ -1,11 +1,19 @@ | |||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
| const Expression = require('./expression'); | import Expression = require('./expression'); | ||||||
| const NoteSet = require('../note_set'); | import NoteSet = require('../note_set'); | ||||||
| const becca = require('../../../becca/becca'); | import becca = require('../../../becca/becca'); | ||||||
|  | import SearchContext = require('../search_context'); | ||||||
|  | 
 | ||||||
|  | type Comparator = (value: string) => boolean; | ||||||
| 
 | 
 | ||||||
| class LabelComparisonExp extends Expression { | class LabelComparisonExp extends Expression { | ||||||
|     constructor(attributeType, attributeName, comparator) { |      | ||||||
|  |     private attributeType: string; | ||||||
|  |     private attributeName: string; | ||||||
|  |     private comparator: Comparator; | ||||||
|  | 
 | ||||||
|  |     constructor(attributeType: string, attributeName: string, comparator: Comparator) { | ||||||
|         super(); |         super(); | ||||||
| 
 | 
 | ||||||
|         this.attributeType = attributeType; |         this.attributeType = attributeType; | ||||||
| @ -13,7 +21,7 @@ class LabelComparisonExp extends Expression { | |||||||
|         this.comparator = comparator; |         this.comparator = comparator; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     execute(inputNoteSet, executionContext, searchContext) { |     execute(inputNoteSet: NoteSet, executionContext: {}, searchContext: SearchContext) { | ||||||
|         const attrs = becca.findAttributes(this.attributeType, this.attributeName); |         const attrs = becca.findAttributes(this.attributeType, this.attributeName); | ||||||
|         const resultNoteSet = new NoteSet(); |         const resultNoteSet = new NoteSet(); | ||||||
| 
 | 
 | ||||||
| @ -38,4 +46,4 @@ class LabelComparisonExp extends Expression { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| module.exports = LabelComparisonExp; | export = LabelComparisonExp; | ||||||
| @ -10,7 +10,7 @@ const ParentOfExp = require('../expressions/parent_of.js'); | |||||||
| const RelationWhereExp = require('../expressions/relation_where.js'); | 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'); | const AttributeExistsExp = require('../expressions/attribute_exists'); | ||||||
| const LabelComparisonExp = require('../expressions/label_comparison.js'); | const LabelComparisonExp = require('../expressions/label_comparison'); | ||||||
| const NoteFlatTextExp = require('../expressions/note_flat_text.js'); | const NoteFlatTextExp = require('../expressions/note_flat_text.js'); | ||||||
| const NoteContentFulltextExp = require('../expressions/note_content_fulltext.js'); | const NoteContentFulltextExp = require('../expressions/note_content_fulltext.js'); | ||||||
| const OrderByAndLimitExp = require('../expressions/order_by_and_limit.js'); | const OrderByAndLimitExp = require('../expressions/order_by_and_limit.js'); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran