aymens

Untitled

Mar 21st, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. /**
  2.  * Processes the search results. Filters out unnecessary nodes
  3.  *
  4.  * @return the final search results object
  5.  */
  6. function processResults(nodes, maxResults)
  7. {    
  8.    var results = [],
  9.       added = 0,
  10.       parts,
  11.       item,
  12.       i, j;
  13.    
  14.    for (i = 0, j = nodes.length; i < j && added < maxResults; i++)
  15.    {
  16.       /**
  17.        * For each node we extract the site/container qname path and then
  18.        * let the per-container helper function decide what to do.
  19.        */
  20.       parts = splitQNamePath(nodes[i]);
  21.       if (parts !== null)
  22.       {
  23.          item = getItem(parts[0], parts[1], parts[2], nodes[i]);
  24.          if (item !== null)
  25.          {
  26.             if( nodes[i]["fragments"] ){ item.fragments = nodes[i]["fragments"]; }
  27.             results.push(item);
  28.             added++;
Add Comment
Please, Sign In to add comment