#NEWLINE# def test_fts( self ) : #NEWLINE# #INDENT# strings = [ 'python and peewee for working with databases' , 'relational databases are the best' , 'sqlite is the best relational database' , 'sqlcipher is a cool database extension' ] #NEWLINE# for s in strings : #NEWLINE# #INDENT# Note . create ( content = query ) #NEWLINE# #UNINDENT# FTSNote . rebuild ( ) #NEWLINE# query = FTSNote . select ( FTSNote , FTSNote . rank ( ) . alias ( 'score' ) ) . where ( FTSNote . match ( 'relational databases' ) ) . order_by ( SQL ( 'score' ) . desc ( ) ) #NEWLINE# notes = [ note . content for note in query ] #NEWLINE# self . assertEqual ( notes , [ 'relational databases are the best' , 'sqlite is the best relational database' ] ) #NEWLINE# alt_conn = SqliteDatabase ( ext_db . database ) #NEWLINE# self . assertRaises ( DatabaseError , alt_conn . execute_sql , ( 'SELECT * FROM "%s"' % FTSNote . _meta . db_table ) )