mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	server-ts: Port services/search/expressions/not
This commit is contained in:
		
							parent
							
								
									571c9f544c
								
							
						
					
					
						commit
						3df6acda32
					
				| @ -1,19 +0,0 @@ | |||||||
| "use strict"; |  | ||||||
| 
 |  | ||||||
| const Expression = require('./expression'); |  | ||||||
| 
 |  | ||||||
| class NotExp extends Expression { |  | ||||||
|     constructor(subExpression) { |  | ||||||
|         super(); |  | ||||||
| 
 |  | ||||||
|         this.subExpression = subExpression; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     execute(inputNoteSet, executionContext, searchContext) { |  | ||||||
|         const subNoteSet = this.subExpression.execute(inputNoteSet, executionContext, searchContext); |  | ||||||
| 
 |  | ||||||
|         return inputNoteSet.minus(subNoteSet); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| module.exports = NotExp; |  | ||||||
							
								
								
									
										23
									
								
								src/services/search/expressions/not.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/services/search/expressions/not.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | "use strict"; | ||||||
|  | 
 | ||||||
|  | import NoteSet = require('../note_set'); | ||||||
|  | import SearchContext = require('../search_context'); | ||||||
|  | import Expression = require('./expression'); | ||||||
|  | 
 | ||||||
|  | class NotExp extends Expression { | ||||||
|  |     private subExpression: Expression; | ||||||
|  | 
 | ||||||
|  |     constructor(subExpression: Expression) { | ||||||
|  |         super(); | ||||||
|  | 
 | ||||||
|  |         this.subExpression = subExpression; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     execute(inputNoteSet: NoteSet, executionContext: {}, searchContext: SearchContext) { | ||||||
|  |         const subNoteSet = this.subExpression.execute(inputNoteSet, executionContext, searchContext); | ||||||
|  | 
 | ||||||
|  |         return inputNoteSet.minus(subNoteSet); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export = NotExp; | ||||||
| @ -3,7 +3,7 @@ | |||||||
| const dayjs = require("dayjs"); | const dayjs = require("dayjs"); | ||||||
| const AndExp = require('../expressions/and'); | const AndExp = require('../expressions/and'); | ||||||
| const OrExp = require('../expressions/or.js'); | const OrExp = require('../expressions/or.js'); | ||||||
| const NotExp = require('../expressions/not.js'); | const NotExp = require('../expressions/not'); | ||||||
| const ChildOfExp = require('../expressions/child_of'); | const ChildOfExp = require('../expressions/child_of'); | ||||||
| const DescendantOfExp = require('../expressions/descendant_of'); | const DescendantOfExp = require('../expressions/descendant_of'); | ||||||
| const ParentOfExp = require('../expressions/parent_of.js'); | const ParentOfExp = require('../expressions/parent_of.js'); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran