/[jsFind]/trunk/html/js/search.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/html/js/search.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by dpavlin, Sun Jul 11 21:15:44 2004 UTC revision 4 by dpavlin, Tue Jul 20 17:08:06 2004 UTC
# Line 33  var conversion = new String Line 33  var conversion = new String
33  var query_left = "";  var query_left = "";
34  var search_err = "";  var search_err = "";
35  var results    = null;  var results    = null;
36    var index_path = "";
37    
38  var watchdog_id = 0;  var watchdog_id = 0;
39  var watchdog_callback = null;  var watchdog_callback = null;
# Line 217  function loadData(xmldoc, url, pos, resu Line 218  function loadData(xmldoc, url, pos, resu
218    
219      if(query_left.length > 0)      if(query_left.length > 0)
220      {      {
221        doSearch(query_left, result_handler);          doSearch(index_path, query_left, result_handler);  
222      }      }
223      else      else
224      {      {
# Line 296  function traverseTree(xmldoc, url, query Line 297  function traverseTree(xmldoc, url, query
297    return;    return;
298  }  }
299    
300  function doSearch(query, result_func)  function doSearch(index_name,query, result_func)
301  {  {
302    //alert("doSearch("+query+")");    //alert("doSearch("+index_name+","+query+")");
303    var pos=query.search(/[\s\+]/);    var pos=query.search(/[\s\+]/);
304      if (index_name) index_path = index_name+'/';
305    
306    if(pos < 0)    if(pos < 0)
307    {    {
# Line 311  function doSearch(query, result_func) Line 313  function doSearch(query, result_func)
313      query = query.slice(0,pos);      query = query.slice(0,pos);
314    }    }
315    
316    if(!loadXML("0.xml", traverseTree, query.toLowerCase(), result_func))    if(!loadXML(index_path+"0.xml", traverseTree, query.toLowerCase(), result_func))
317    {    {
318      debug("ERROR: Couldn't find main index 0.xml");      debug("ERROR: Couldn't find main index 0.xml");
319      search_err = "INTERNAL ERROR: Unable to load main index 0.xml";      search_err = "INTERNAL ERROR: Unable to load main index 0.xml";

Legend:
Removed from v.2  
changed lines
  Added in v.4

  ViewVC Help
Powered by ViewVC 1.1.26