Pman.SearchTokenizer = function(s)
{
- this.str = s;
- this.strlen = s.length;
+ this.str = typeof(s) == 'string' ? s : '';
+ this.strlen = typeof(s) == 'string' ? s.length : 0;
this.i = 0;
this.tokens = [];
//print_r(this);
}
}
+ // sort tokens longest first..
+
+
+
// should not get here...
return this.tokens;
},
}
if (!q) {
- if ((s..toUpperCase() == 'AND') || (s.toUpperCase() == 'OR')) {
+ if ((s.toUpperCase() == 'AND') || (s.toUpperCase() == 'OR')) {
this.tokens.push( { type: s.toUpperCase() });
return;
}
}
- this.tokens.push( { type : 's' , v : s });
+ this.tokens.push( { type : 's' , v : s, q: q });
},
getChar : function ()
};
Pman.SearchTokenizer.parse = function(v) {
- var x = new Pman.SearchTokenizer();
+ var x = new Pman.SearchTokenizer(v);
return x.parse();
}
\ No newline at end of file