X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Pman.SearchTokenizer.js;h=8db0be1b8579dbfad2a4dac29c7e41c7d518e78a;hb=692861c958898f425cc365906c092559d7cfc60c;hp=5882e369ed8af57a81e5796753deb2cfbc8971e3;hpb=00a84e3ec752422b109121dca21c84d70b28d8d0;p=Pman.Core diff --git a/Pman.SearchTokenizer.js b/Pman.SearchTokenizer.js index 5882e369..8db0be1b 100644 --- a/Pman.SearchTokenizer.js +++ b/Pman.SearchTokenizer.js @@ -14,8 +14,8 @@ 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); @@ -49,6 +49,10 @@ Pman.SearchTokenizer.prototype = { } } + // sort tokens longest first.. + + + // should not get here... return this.tokens; }, @@ -116,7 +120,7 @@ Pman.SearchTokenizer.prototype = { return; } } - this.tokens.push( { type : 's' , v : s }); + this.tokens.push( { type : 's' , v : s, q: q }); }, getChar : function () @@ -137,7 +141,7 @@ Pman.SearchTokenizer.prototype = { }; 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