<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 10pt; color: #000000'><div class="content">
    <p>I have a custom search.  Right now, the search results page is displayed after the search is completed.</p>
<p>Is there a way to display the search results as they are located?</p>
<p><br></p><p>For example, in the hook_search api <a href="http://api.drupal.org/api/function/hook_search/5" title="http://api.drupal.org/api/function/hook_search/5" rel="nofollow">http://api.drupal.org/api/function/hook_search/5</a>, this is how the results are located in a generic custom search:<br>
</p><div class="codeblock"><code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);">&lt;?php<br>&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(0, 119, 0);">case </span><span style="color: rgb(221, 0, 0);">'search'</span><span style="color: rgb(0, 119, 0);">:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(0, 0, 187);">$find </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">do_search</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$keys</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">'node'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">'INNER JOIN {node} n ON n.nid = i.sid '</span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">node_access_join_sql</span><span style="color: rgb(0, 119, 0);">() .</span><span style="color: rgb(221, 0, 0);">' INNER JOIN {users} u ON n.uid = u.uid'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">'n.status = 1 AND '</span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">node_access_where_sql</span><span style="color: rgb(0, 119, 0);">());<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(0, 0, 187);">$results </span><span style="color: rgb(0, 119, 0);">= array();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (</span><span style="color: rgb(0, 0, 187);">$find </span><span style="color: rgb(0, 119, 0);">as </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(0, 0, 187);">$node </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">node_load</span><span style="color: rgb(0, 119, 0);">(array(</span><span style="color: rgb(221, 0, 0);">'nid' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(0, 0, 187);">$extra </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">node_invoke_nodeapi</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">'search result'</span><span style="color: rgb(0, 119, 0);">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(0, 0, 187);">$results</span><span style="color: rgb(0, 119, 0);">[] = array(</span><span style="color: rgb(221, 0, 0);">'link' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">url</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'node/'</span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(221, 0, 0);">'type' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">node_invoke</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">'node_name'</span><span style="color: rgb(0, 119, 0);">),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(221, 0, 0);">'title' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">title</span><span style="color: rgb(0, 119, 0);">,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(221, 0, 0);">'user' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">theme</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'username'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(221, 0, 0);">'date' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">changed</span><span style="color: rgb(0, 119, 0);">,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(221, 0, 0);">'extra' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">$extra</span><span style="color: rgb(0, 119, 0);">,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: rgb(221, 0, 0);">'snippet' </span><span style="color: rgb(0, 119, 0);">=&gt; </span><span style="color: rgb(0, 0, 187);">search_excerpt</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$keys</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">check_output</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">body</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$node</span><span style="color: rgb(0, 119, 0);">-&gt;</span><span style="color: rgb(0, 0, 187);">format</span><span style="color: rgb(0, 119, 0);">)));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </span><span style="color: rgb(0, 0, 187);">$results</span><span style="color: rgb(0, 119, 0);">;<br></span><span style="color: rgb(0, 0, 187);">?&gt;</span></span></code></div><br>
What I am asking: Is there a way to print each <b>$result[]</b> item as it is located rather than returning the <b>$results</b> array to print the page after the search is completed?
<p><br></p><p>My problem is that my custom search uses a 3rd party search, then I
have to parse the those results using a query to a Drupal table. Then,
I populate the <b>$results</b> array. This is taking a very long time,
but I don't see a lot of ways round it. What would give the impression
of it not taking so long would be if the search results started popping
up immediately.</p>
<p><br></p><p>Thanks for any suggestions.<br></p><p><br></p><p>-ron<br></p><p><br></p>
  </div></div></body></html>