2024-07-18 21:35:17 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								import  searchService  from  "../../src/services/search/services/search.js" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  BNote  from  "../../src/becca/entities/bnote.js" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  BBranch  from  "../../src/becca/entities/bbranch.js" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  SearchContext  from  "../../src/services/search/search_context.js" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  dateUtils  from  "../../src/services/date_utils.js" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  becca  from  "../../src/becca/becca.js" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import  becca_mocking  from  "./becca_mocking.js" ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								describe ( "Search" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    let  rootNote : any ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    beforeEach ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        becca . reset ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        rootNote  =  new  becca_mocking . NoteBuilder ( new  BNote ( {  noteId :  "root" ,  title :  "root" ,  type :  "text"  } ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        new  BBranch ( { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            branchId :  "none_root" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            noteId :  "root" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            parentNoteId :  "none" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            notePosition : 10 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "simple path match" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( becca_mocking . note ( "Austria" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "europe austria" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "normal search looks also at attributes" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  austria  =  becca_mocking . note ( "Austria" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  vienna  =  becca_mocking . note ( "Vienna" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        rootNote . child ( austria . relation ( "capital" ,  vienna . note ) ) . child ( vienna . label ( "inhabitants" ,  "1888776" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "capital" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "inhabitants" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Vienna" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "normal search looks also at type and mime" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Effective Java" ,  {  type :  "book" ,  mime :  ""  } ) ) . child ( becca_mocking . note ( "Hello World.java" ,  {  type :  "code" ,  mime :  "text/x-java"  } ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "book" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Effective Java" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "text" ,  searchContext ) ;  // should match mime
 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Hello World.java" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "java" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "only end leafs are results" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( becca_mocking . note ( "Austria" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "europe" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Europe" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "only end leafs are results" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( becca_mocking . note ( "Austria" ) . label ( "capital" ,  "Vienna" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "Vienna" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "label comparison with short syntax" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( becca_mocking . note ( "Austria" ) . label ( "capital" ,  "Vienna" ) ) . child ( becca_mocking . note ( "Czech Republic" ) . label ( "capital" ,  "Prague" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "#capital=Vienna" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // case sensitivity:
 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "#CAPITAL=VIENNA" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "#caPItal=vienNa" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "label comparison with full syntax" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( becca_mocking . note ( "Austria" ) . label ( "capital" ,  "Vienna" ) ) . child ( becca_mocking . note ( "Czech Republic" ) . label ( "capital" ,  "Prague" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# note.labels.capital=Prague" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "numeric label comparison" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "country" ,  "" ,  true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Austria" ) . label ( "population" ,  "8859000" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Czech Republic" ) . label ( "population" ,  "10650000" ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "#country #population >= 10000000" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "inherited label comparison" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . label ( "country" ,  "" ,  true ) . child ( becca_mocking . note ( "Austria" ) ) . child ( becca_mocking . note ( "Czech Republic" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "austria #country" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "numeric label comparison fallback to string comparison" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // dates should not be coerced into numbers which would then give wrong numbers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "country" ,  "" ,  true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Austria" ) . label ( "established" ,  "1955-07-27" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Czech Republic" ) . label ( "established" ,  "1993-01-01" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Hungary" ) . label ( "established" ,  "1920-06-04" ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( '#established <= "1955-01-01"' ,  searchContext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Hungary" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( '#established > "1955-01-01"' ,  searchContext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "smart date comparisons" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // dates should not be coerced into numbers which would then give wrong numbers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "My note" ,  {  dateCreated : dateUtils.localNowDateTime ( )  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "year" ,  new  Date ( ) . getFullYear ( ) . toString ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "month" ,  dateUtils . localNowDate ( ) . substr ( 0 ,  7 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "date" ,  dateUtils . localNowDate ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "dateTime" ,  dateUtils . localNowDateTime ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        function  test ( query : string ,  expectedResultCount : number )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            const  searchResults  =  searchService . findResultsWithQuery ( query ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-15 22:36:09 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            expect ( searchResults . length ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . withContext ( ` While searching for  ${ query }  got unexpected result: [ ${ searchResults . join ( ", " ) } ] ` ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . toEqual ( expectedResultCount ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  ( expectedResultCount  ===  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                expect ( becca_mocking . findNoteByTitle ( searchResults ,  "My note" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "#year = YEAR" ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#year = 'YEAR'" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "#year >= YEAR" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#year <= YEAR" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#year < YEAR+1" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#year < YEAR + 1" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#year < year + 1" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#year > YEAR+1" ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#month = MONTH" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#month = month" ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#month = 'MONTH'" ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "note.dateCreated =* month" ,  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "#date = TODAY" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#date = today" ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#date = 'today'" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "#date > TODAY" ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#date > TODAY-1" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#date > TODAY - 1" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#date < TODAY+1" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#date < TODAY + 1" ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#date < 'TODAY + 1'" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "#dateTime <= NOW+10" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#dateTime <= NOW + 10" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#dateTime < NOW-10" ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#dateTime >= NOW-10" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "#dateTime < NOW-10" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "logical or" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "country" ,  "" ,  true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Austria" ) . label ( "languageFamily" ,  "germanic" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Czech Republic" ) . label ( "languageFamily" ,  "slavic" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Hungary" ) . label ( "languageFamily" ,  "finnougric" ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "#languageFamily = slavic OR #languageFamily = germanic" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "fuzzy attribute search" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . label ( "country" ,  "" ,  true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Austria" ) . label ( "languageFamily" ,  "germanic" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Czech Republic" ) . label ( "languageFamily" ,  "slavic" ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        let  searchContext  =  new  SearchContext ( {  fuzzyAttributeSearch : false  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "#language" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "#languageFamily=ger" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        searchContext  =  new  SearchContext ( {  fuzzyAttributeSearch : true  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "#language" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "#languageFamily=ger" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "filter by note property" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( becca_mocking . note ( "Austria" ) ) . child ( becca_mocking . note ( "Czech Republic" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "# note.title =* czech" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    it ( "filter by note's parent" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    . child ( becca_mocking . note ( "Austria" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    . child ( becca_mocking . note ( "Czech Republic" ) . child ( becca_mocking . note ( "Prague" ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            . child ( becca_mocking . note ( "Asia" ) . child ( becca_mocking . note ( "Taiwan" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Europe" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Asia" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Taiwan" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.parents.parents.title = Europe" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Prague" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    it ( "filter by note's ancestor" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    . child ( becca_mocking . note ( "Austria" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    . child ( becca_mocking . note ( "Czech Republic" ) . child ( becca_mocking . note ( "Prague" ) . label ( "city" ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            . child ( becca_mocking . note ( "Asia" ) . child ( becca_mocking . note ( "Taiwan" ) . child ( becca_mocking . note ( "Taipei" ) . label ( "city" ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "#city AND note.ancestors.title = Europe" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Prague" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "#city AND note.ancestors.title = Asia" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Taipei" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    it ( "filter by note's child" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    . child ( becca_mocking . note ( "Austria" ) . child ( becca_mocking . note ( "Vienna" ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    . child ( becca_mocking . note ( "Czech Republic" ) . child ( becca_mocking . note ( "Prague" ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            . child ( becca_mocking . note ( "Oceania" ) . child ( becca_mocking . note ( "Australia" ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# note.children.title =* Aust" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Europe" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Oceania" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.children.title =* Aust AND note.children.title *= republic" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Europe" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.children.children.title = Prague" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Europe" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    it ( "filter by relation's note properties using short syntax" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  austria  =  becca_mocking . note ( "Austria" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  portugal  =  becca_mocking . note ( "Portugal" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "Europe" ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                . child ( austria ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Czech Republic" ) . relation ( "neighbor" ,  austria . note ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                . child ( portugal ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Spain" ) . relation ( "neighbor" ,  portugal . note ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# ~neighbor.title = Austria" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# ~neighbor.title = Portugal" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Spain" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    it ( "filter by relation's note properties using long syntax" ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  austria  =  becca_mocking . note ( "Austria" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  portugal  =  becca_mocking . note ( "Portugal" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "Europe" ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                . child ( austria ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Czech Republic" ) . relation ( "neighbor" ,  austria . note ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                . child ( portugal ) 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Spain" ) . relation ( "neighbor" ,  portugal . note ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  searchResults  =  searchService . findResultsWithQuery ( "# note.relations.neighbor.title = Austria" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "filter by multiple level relation" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  austria  =  becca_mocking . note ( "Austria" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  slovakia  =  becca_mocking . note ( "Slovakia" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  italy  =  becca_mocking . note ( "Italy" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  ukraine  =  becca_mocking . note ( "Ukraine" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote . child ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            becca_mocking 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                . note ( "Europe" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( austria . relation ( "neighbor" ,  italy . note ) . relation ( "neighbor" ,  slovakia . note ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( becca_mocking . note ( "Czech Republic" ) . relation ( "neighbor" ,  austria . note ) . relation ( "neighbor" ,  slovakia . note ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                . child ( slovakia . relation ( "neighbor" ,  ukraine . note ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                . child ( ukraine ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# note.relations.neighbor.relations.neighbor.title = Italy" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.relations.neighbor.relations.neighbor.title = Ukraine" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Czech Republic" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca_mocking . findNoteByTitle ( searchResults ,  "Austria" ) ) . toBeTruthy ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "test note properties" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  austria  =  becca_mocking . note ( "Austria" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        austria . relation ( "myself" ,  austria . note ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        austria . label ( "capital" ,  "Vienna" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        austria . label ( "population" ,  "8859000" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rootNote 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            . child ( becca_mocking . note ( "Asia" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            . child ( becca_mocking . note ( "Europe" ) . child ( austria . child ( becca_mocking . note ( "Vienna" ) ) . child ( becca_mocking . note ( "Sebastian Kurz" ) ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            . child ( becca_mocking . note ( "Mozart" ) . child ( austria ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        austria . note . isProtected  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        austria . note . dateCreated  =  "2020-05-14 12:11:42.001+0200" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        austria . note . dateModified  =  "2020-05-14 13:11:42.001+0200" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        austria . note . utcDateCreated  =  "2020-05-14 10:11:42.001Z" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        austria . note . utcDateModified  =  "2020-05-14 11:11:42.001Z" ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        // austria.note.contentLength = 1001;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        function  test ( propertyName : string ,  value : string ,  expectedResultCount : number )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            const  searchResults  =  searchService . findResultsWithQuery ( ` # note. ${ propertyName }  =  ${ value } ` ,  searchContext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            expect ( searchResults . length ) . toEqual ( expectedResultCount ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "type" ,  "text" ,  7 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "TYPE" ,  "TEXT" ,  7 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "type" ,  "code" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "mime" ,  "text/html" ,  6 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "mime" ,  "application/json" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "isProtected" ,  "false" ,  7 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "isProtected" ,  "FALSE" ,  7 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "isProtected" ,  "true" ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "isProtected" ,  "TRUE" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "dateCreated" ,  "'2020-05-14 12:11:42.001+0200'" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "dateCreated" ,  "wrong" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "dateModified" ,  "'2020-05-14 13:11:42.001+0200'" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "dateModified" ,  "wrong" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "utcDateCreated" ,  "'2020-05-14 10:11:42.001Z'" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "utcDateCreated" ,  "wrong" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "utcDateModified" ,  "'2020-05-14 11:11:42.001Z'" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "utcDateModified" ,  "wrong" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "parentCount" ,  "2" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "parentCount" ,  "3" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "childrenCount" ,  "2" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "childrenCount" ,  "10" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "attributeCount" ,  "3" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "attributeCount" ,  "4" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "labelCount" ,  "2" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "labelCount" ,  "3" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        test ( "relationCount" ,  "1" ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test ( "relationCount" ,  "2" ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "test order by" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  italy  =  becca_mocking . note ( "Italy" ) . label ( "capital" ,  "Rome" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  slovakia  =  becca_mocking . note ( "Slovakia" ) . label ( "capital" ,  "Bratislava" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  austria  =  becca_mocking . note ( "Austria" ) . label ( "capital" ,  "Vienna" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  ukraine  =  becca_mocking . note ( "Ukraine" ) . label ( "capital" ,  "Kiev" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( ukraine ) . child ( slovakia ) . child ( austria ) . child ( italy ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Europe orderBy note.title" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Austria" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 1 ] . noteId ] . title ) . toEqual ( "Italy" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 2 ] . noteId ] . title ) . toEqual ( "Slovakia" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 3 ] . noteId ] . title ) . toEqual ( "Ukraine" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Europe orderBy note.labels.capital" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Slovakia" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 1 ] . noteId ] . title ) . toEqual ( "Ukraine" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 2 ] . noteId ] . title ) . toEqual ( "Italy" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 3 ] . noteId ] . title ) . toEqual ( "Austria" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Europe orderBy note.labels.capital DESC" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Austria" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 1 ] . noteId ] . title ) . toEqual ( "Italy" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 2 ] . noteId ] . title ) . toEqual ( "Ukraine" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 3 ] . noteId ] . title ) . toEqual ( "Slovakia" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Europe orderBy note.labels.capital DESC limit 2" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Austria" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 1 ] . noteId ] . title ) . toEqual ( "Italy" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Europe orderBy #capital DESC limit 1" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "# note.parents.title = Europe orderBy #capital DESC limit 1000" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 4 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    it ( "test not(...)" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  italy  =  becca_mocking . note ( "Italy" ) . label ( "capital" ,  "Rome" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  slovakia  =  becca_mocking . note ( "Slovakia" ) . label ( "capital" ,  "Bratislava" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( slovakia ) . child ( italy ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# not(#capital) and note.noteId != root" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Europe" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        searchResults  =  searchService . findResultsWithQuery ( "#!capital and note.noteId != root" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Europe" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "test note.text *=* something" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  italy  =  becca_mocking . note ( "Italy" ) . label ( "capital" ,  "Rome" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  slovakia  =  becca_mocking . note ( "Slovakia" ) . label ( "capital" ,  "Bratislava" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Europe" ) . child ( slovakia ) . child ( italy ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "# note.text *=* vaki and note.noteId != root" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Slovakia" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    xit ( "test that fulltext does not match archived notes" ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  italy  =  becca_mocking . note ( "Italy" ) . label ( "capital" ,  "Rome" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  slovakia  =  becca_mocking . note ( "Slovakia" ) . label ( "capital" ,  "Bratislava" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        rootNote . child ( becca_mocking . note ( "Reddit" ) . label ( "archived" ,  "" ,  true ) . child ( becca_mocking . note ( "Post X" ) ) . child ( becca_mocking . note ( "Post Y" ) ) ) . child ( becca_mocking . note ( "Reddit is bad" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        const  searchContext  =  new  SearchContext ( {  includeArchivedNotes : false  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        let  searchResults  =  searchService . findResultsWithQuery ( "reddit" ,  searchContext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        expect ( searchResults . length ) . toEqual ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-09 18:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        expect ( becca . notes [ searchResults [ 0 ] . noteId ] . title ) . toEqual ( "Reddit is bad" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-08 23:59:11 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // FIXME: test what happens when we order without any filter criteria
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // it("comparison between labels", () => {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //     rootNote
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //         .child(becca_mocking.note("Europe")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //             .child(becca_mocking.note("Austria")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //                 .label('capital', 'Vienna')
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //                 .label('largestCity', 'Vienna'))
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //             .child(becca_mocking.note("Canada")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //                 .label('capital', 'Ottawa')
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //                 .label('largestCity', 'Toronto'))
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //             .child(becca_mocking.note("Czech Republic")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //                 .label('capital', 'Prague')
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //                 .label('largestCity', 'Prague'))
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //         );
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //     const searchContext = new SearchContext();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //     const searchResults = searchService.findResultsWithQuery('#capital = #largestCity', searchContext);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //     expect(searchResults.length).toEqual(2);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //     expect(becca_mocking.findNoteByTitle(searchResults, "Czech Republic")).toBeTruthy();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    //     expect(becca_mocking.findNoteByTitle(searchResults, "Austria")).toBeTruthy();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // })
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ) ;