mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	search note content only if not excluded by other expressions
This commit is contained in:
		
							parent
							
								
									4f27254e64
								
							
						
					
					
						commit
						e89057a771
					
				| @ -32,11 +32,15 @@ class NoteContentProtectedFulltextExp extends Expression { | |||||||
|                 FROM notes JOIN note_contents USING (noteId)  |                 FROM notes JOIN note_contents USING (noteId)  | ||||||
|                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 1`)) {
 |                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 1`)) {
 | ||||||
| 
 | 
 | ||||||
|  |             if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             try { |             try { | ||||||
|                 content = protectedSessionService.decryptString(content); |                 content = protectedSessionService.decryptString(content); | ||||||
|             } |             } | ||||||
|             catch (e) { |             catch (e) { | ||||||
|                 log.info('Cannot decrypt content of note', noteId); |                 log.info(`Cannot decrypt content of note ${noteId}`); | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| @ -50,11 +54,7 @@ class NoteContentProtectedFulltextExp extends Expression { | |||||||
|                 content = content.replace(/ /g, ' '); |                 content = content.replace(/ /g, ' '); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (this.tokens.find(token => !content.includes(token))) { |             if (!this.tokens.find(token => !content.includes(token))) { | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) { |  | ||||||
|                 resultNoteSet.add(noteCache.notes[noteId]); |                 resultNoteSet.add(noteCache.notes[noteId]); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -26,6 +26,10 @@ class NoteContentUnprotectedFulltextExp extends Expression { | |||||||
|                 FROM notes JOIN note_contents USING (noteId)  |                 FROM notes JOIN note_contents USING (noteId)  | ||||||
|                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 0`)) {
 |                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 0`)) {
 | ||||||
| 
 | 
 | ||||||
|  |             if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             content = content.toString().toLowerCase(); |             content = content.toString().toLowerCase(); | ||||||
| 
 | 
 | ||||||
|             if (type === 'text' && mime === 'text/html') { |             if (type === 'text' && mime === 'text/html') { | ||||||
| @ -36,11 +40,7 @@ class NoteContentUnprotectedFulltextExp extends Expression { | |||||||
|                 content = content.replace(/ /g, ' '); |                 content = content.replace(/ /g, ' '); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (this.tokens.find(token => !content.includes(token))) { |             if (!this.tokens.find(token => !content.includes(token))) { | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) { |  | ||||||
|                 resultNoteSet.add(noteCache.notes[noteId]); |                 resultNoteSet.add(noteCache.notes[noteId]); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam