@@ -1032,37 +1032,37 @@ export default class ParseQuery {
10321032 return this . _addCondition ( key , '$geoIntersects' , { '$point' : point } ) ;
10331033 }
10341034
1035- /**
1036- * Method to find by full text.
1037- * The key and the search fields are required the others are optionals.
1038- * @method fullTextSearch
1039- * @param {String } key The key to structure the where query
1040- * @param {String } search The string to search
1041- * @param {String } language Determine the list of stop words
1042- * @param {Boolean } caseSensitive Dis/en-able the case sensitive search
1043- * @param {Boolean } diacriticSensitive Dis/en-able diacritic sensitive search
1044- * @return {Parse.Query } Returns the query, so you can chain this call.
1045- */
1046- fullTextSearch ( key : string , search : string , language : string , caseSensitive : boolean , diacriticSensitive : boolean ) : ParseQuery {
1047- if ( typeof key === 'undefined' || ! key ) {
1048- throw new Error ( 'A key is required.' ) ;
1049- }
1050- if ( typeof search === 'undefined' || ! search ) {
1051- throw new Error ( 'You have to add one string to search .' ) ;
1052- }
1053- var options = { '$term' : search } ;
1054- if ( typeof language !== "undefined" || language !== null ) {
1055- options [ '$language' ] = language ;
1056- }
1057- if ( typeof caseSensitive !== "undefined" || caseSensitive !== null ) {
1058- options [ '$caseSensitive' ] = caseSensitive ;
1059- }
1060- if ( typeof diacriticSensitive !== "undefined" || diacriticSensitive !== null ) {
1061- options [ '$diacriticSensitive' ] = diacriticSensitive ;
1062- }
1063- return this . _addCondition ( key , '$text' , { '$search' : options } ) ;
1064- }
1065-
1035+ /**
1036+ * Method to find by full text.
1037+ * The key and the search fields are required the others are optionals.
1038+ * @method fullTextSearch
1039+ * @param {String } key The key to structure the where query
1040+ * @param {String } search The string to search
1041+ * @param {String } language Determine the list of stop words
1042+ * @param {Boolean } caseSensitive Dis/en-able the case sensitive search
1043+ * @param {Boolean } diacriticSensitive Dis/en-able diacritic sensitive search
1044+ * @return {Parse.Query } Returns the query, so you can chain this call.
1045+ */
1046+ fullTextSearch ( key : string , search : string , language : string , caseSensitive : boolean , diacriticSensitive : boolean ) : ParseQuery {
1047+ if ( ! key ) {
1048+ throw new Error ( 'A key is required.' ) ;
1049+ }
1050+ if ( typeof search !== 'string' ) {
1051+ throw new Error ( 'The value being searched for must be a string .' ) ;
1052+ }
1053+ var options = { '$term' : search } ;
1054+ if ( typeof language === 'string' ) {
1055+ options [ '$language' ] = language ;
1056+ }
1057+ if ( typeof caseSensitive === "boolean" ) {
1058+ options [ '$caseSensitive' ] = caseSensitive ;
1059+ }
1060+ if ( typeof diacriticSensitive === "boolean" ) {
1061+ options [ '$diacriticSensitive' ] = diacriticSensitive ;
1062+ }
1063+ return this . _addCondition ( key , '$text' , { '$search' : options } ) ;
1064+ }
1065+
10661066 /** Query Orderings **/
10671067
10681068 /**
0 commit comments