@@ -578,7 +578,7 @@ describe('Parse Query', () => {
578578 assert . equal ( results [ 2 ] . get ( 'string' ) , 'd' ) ;
579579 assert . equal ( results [ 3 ] . get ( 'number' ) , 1 ) ;
580580 assert . equal ( results [ 3 ] . get ( 'string' ) , 'b' ) ;
581-
581+
582582 let query = new Parse . Query ( TestObject ) ;
583583 query . equalTo ( 'doubleDescending' , true ) ;
584584 query . descending ( 'number, string' ) ;
@@ -608,7 +608,7 @@ describe('Parse Query', () => {
608608 assert . equal ( results [ 2 ] . get ( 'string' ) , 'd' ) ;
609609 assert . equal ( results [ 3 ] . get ( 'number' ) , 1 ) ;
610610 assert . equal ( results [ 3 ] . get ( 'string' ) , 'b' ) ;
611-
611+
612612 let query = new Parse . Query ( TestObject ) ;
613613 query . equalTo ( 'doubleDescending' , true ) ;
614614 query . descending ( 'number' , 'string' ) ;
@@ -623,7 +623,7 @@ describe('Parse Query', () => {
623623 assert . equal ( results [ 2 ] . get ( 'string' ) , 'd' ) ;
624624 assert . equal ( results [ 3 ] . get ( 'number' ) , 1 ) ;
625625 assert . equal ( results [ 3 ] . get ( 'string' ) , 'b' ) ;
626-
626+
627627 done ( ) ;
628628 } ) ;
629629 } ) ;
@@ -760,7 +760,7 @@ describe('Parse Query', () => {
760760 assert . equal ( results . length , 2 ) ;
761761 assert . equal ( results [ 0 ] . id , objects [ 0 ] . id ) ;
762762 assert . equal ( results [ 1 ] . id , objects [ 1 ] . id ) ;
763-
763+
764764 let query = new Parse . Query ( 'TestObject' ) ;
765765 query . equalTo ( 'timed2' , true ) ;
766766 query . greaterThan ( 'createdAt' , objects [ 2 ] . createdAt ) ;
@@ -1210,7 +1210,7 @@ describe('Parse Query', () => {
12101210 } ) . then ( ( results ) => {
12111211 assert . equal ( results . length , 1 ) ;
12121212 assert . equal ( results [ 0 ] . get ( 'name' ) , 'Bob' ) ;
1213-
1213+
12141214 let query = new Parse . Query ( Restaurant ) ;
12151215 query . greaterThan ( 'rating' , 4 ) ;
12161216 let mainQuery = new Parse . Query ( Person ) ;
@@ -1426,4 +1426,61 @@ describe('Parse Query', () => {
14261426 done ( ) ;
14271427 } ) ;
14281428 } ) ;
1429+
1430+ it ( 'full text search' , ( done ) => {
1431+ const subjects = [
1432+ 'coffee' ,
1433+ 'Coffee Shopping' ,
1434+ 'Baking a cake' ,
1435+ 'baking' ,
1436+ 'Café Con Leche' ,
1437+ 'Сырники' ,
1438+ 'coffee and cream' ,
1439+ 'Cafe con Leche' ,
1440+ ] ;
1441+ const objects = [ ] ;
1442+ for ( const i in subjects ) {
1443+ const obj = new TestObject ( { subject : subjects [ i ] } ) ;
1444+ objects . push ( obj ) ;
1445+ }
1446+ Parse . Object . saveAll ( objects ) . then ( ( ) => {
1447+ const q = new Parse . Query ( TestObject ) ;
1448+ q . fullText ( 'subject' , 'coffee' ) ;
1449+ return q . find ( ) ;
1450+ } ) . then ( ( results ) => {
1451+ assert . equal ( results . length , 3 ) ;
1452+ done ( ) ;
1453+ } ) ;
1454+ } ) ;
1455+
1456+ it ( 'full text search sort' , ( done ) => {
1457+ const subjects = [
1458+ 'coffee' ,
1459+ 'Coffee Shopping' ,
1460+ 'Baking a cake' ,
1461+ 'baking' ,
1462+ 'Café Con Leche' ,
1463+ 'Сырники' ,
1464+ 'coffee and cream' ,
1465+ 'Cafe con Leche' ,
1466+ ] ;
1467+ const objects = [ ] ;
1468+ for ( const i in subjects ) {
1469+ const obj = new TestObject ( { comment : subjects [ i ] } ) ;
1470+ objects . push ( obj ) ;
1471+ }
1472+ Parse . Object . saveAll ( objects ) . then ( ( ) => {
1473+ const q = new Parse . Query ( TestObject ) ;
1474+ q . fullText ( 'comment' , 'coffee' ) ;
1475+ q . ascending ( '$score' ) ;
1476+ q . select ( '$score' ) ;
1477+ return q . find ( ) ;
1478+ } ) . then ( ( results ) => {
1479+ assert . equal ( results . length , 3 ) ;
1480+ assert . equal ( results [ 0 ] . get ( 'score' ) , 1 ) ;
1481+ assert . equal ( results [ 1 ] . get ( 'score' ) , 0.75 ) ;
1482+ assert . equal ( results [ 2 ] . get ( 'score' ) , 0.75 ) ;
1483+ done ( ) ;
1484+ } ) ;
1485+ } ) ;
14291486} ) ;
0 commit comments