mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	fixed bug in search where note with inherited attribute is not matched when the owning note is not matched, #2457
This commit is contained in:
		
							parent
							
								
									b1c4737e78
								
							
						
					
					
						commit
						b8eeb0371c
					
				| @ -157,6 +157,21 @@ describe("Search", () => { | |||||||
|         expect(findNoteByTitle(searchResults, "Czech Republic")).toBeTruthy(); |         expect(findNoteByTitle(searchResults, "Czech Republic")).toBeTruthy(); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     it("inherited label comparison", () => { | ||||||
|  |         rootNote | ||||||
|  |             .child(note("Europe") | ||||||
|  |                 .label('country', '', true) | ||||||
|  |                 .child(note("Austria")) | ||||||
|  |                 .child(note("Czech Republic")) | ||||||
|  |             ); | ||||||
|  | 
 | ||||||
|  |         const searchContext = new SearchContext(); | ||||||
|  | 
 | ||||||
|  |         const searchResults = searchService.findResultsWithQuery('austria #country', searchContext); | ||||||
|  |         expect(searchResults.length).toEqual(1); | ||||||
|  |         expect(findNoteByTitle(searchResults, "Austria")).toBeTruthy(); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     it("numeric label comparison fallback to string comparison", () => { |     it("numeric label comparison fallback to string comparison", () => { | ||||||
|         // dates should not be coerced into numbers which would then give wrong numbers
 |         // dates should not be coerced into numbers which would then give wrong numbers
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -23,7 +23,6 @@ class AttributeExistsExp extends Expression { | |||||||
|         for (const attr of attrs) { |         for (const attr of attrs) { | ||||||
|             const note = attr.note; |             const note = attr.note; | ||||||
| 
 | 
 | ||||||
|             if (inputNoteSet.hasNoteId(note.noteId)) { |  | ||||||
|             if (attr.isInheritable) { |             if (attr.isInheritable) { | ||||||
|                 resultNoteSet.addAll(note.getSubtreeNotesIncludingTemplated()); |                 resultNoteSet.addAll(note.getSubtreeNotesIncludingTemplated()); | ||||||
|             } |             } | ||||||
| @ -34,9 +33,8 @@ class AttributeExistsExp extends Expression { | |||||||
|                 resultNoteSet.add(note); |                 resultNoteSet.add(note); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         return resultNoteSet; |         return resultNoteSet.intersection(inputNoteSet); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam