Hook_search_execute(); i am using this hook in my custom module but getting a fatal error


  Fatal error: Cannot use object of type stdClass as array in
  C:\wamp\www\bid\includes\common.inc on line 5901


Anyone can help???

Below is my code, I have two conditions in it. In the second condition I want to search with taxonomy index because I have added a filter contains taxonomy parent term.

/**
 * Implements hook_search_execute
 * Override core node_search_execute here with custom implementation
 * Basically a clone of node_search_execute, but with limit variable available
 * See mymodule_module_implements_alter
 */
   function mymodule_search_execute($keys = NULL, $conditions = NULL) {
 // Add new limit conf variable
   $limit = variable_get('search_result_limit', 10);
 // Build matching conditions
  $prnt = (isset($_REQUEST['prnt'])) ? $_REQUEST['prnt'] : 'none';
  $site = (isset($_REQUEST['chld'])) ? $_REQUEST['chld'] : 'none'; 

  $query = db_select('search_index', 'i', array('target' =&gt; 'slave'))-&gt;extend('SearchQuery')-&gt;extend('PagerDefault');
    if (($prnt != 'none' &amp;&amp; $site!= 'none') || ($prnt = 'none' &amp;&amp; $site!= 'none')) {

        $query-&gt;leftjoin('node', 'n', 'n.nid = i.sid');
        $query-&gt;leftjoin('field_data_field_category', 'fdfc', ' fdfc.entity_id = i.sid ');
        $query-&gt;leftjoin('taxonomy_term_data', 'txd', 'txd.tid = fdfc.field_category_tid');
        $query-&gt;condition('txd.name', $site, '='); 
    }

    if ($prnt != 'none' &amp;&amp; $site = 'none') {

        $query= db_select('taxonomy_index', 'ti');
        $query-&gt;leftjoin('node', 'n', 'n.nid = ti.nid');
        $query-&gt;leftjoin('taxonomy_term_data', 'txd', 'txd.tid = ti.tid');
        $query-&gt;leftjoin('taxonomy_term_hierarchy', 'tth', 'tth.tid=txd.tid');
        $query-&gt;condition('tth.parent', '$prnt', '='); 

    }


   $query-&gt;join('node', 'n', 'n.nid = i.sid');
   $query
         -&gt;condition('n.status', 1)
         -&gt;addTag('node_access')
         -&gt;searchExpression($keys, 'node');

   // Insert special keywords.
   $query-&gt;setOption('type', 'n.type');
   $query-&gt;setOption('language', 'n.language');
   if ($query-&gt;setOption('term', 'ti.tid')) {
   $query-&gt;join('taxonomy_index', 'ti', 'n.nid = ti.nid');
 }
  // Only continue if the first pass query matches.
 if (!$query-&gt;executeFirstPass()) {
  return array();
  }

 // Add the ranking expressions.
  _node_rankings($query);

// Load results, use limit variable
  $find = $query
   -&gt;limit($limit)
   -&gt;execute();
 $results = array();
 foreach ($find as $item) {
  // Render the node.
  $node = node_load($item-&gt;sid);
  $build = node_view($node, 'search_result');
  unset($build['#theme']);
  $node-&gt;rendered = drupal_render($build);

  // Fetch comments for snippet.
  $node-&gt;rendered .= ' ' . module_invoke('comment', 'node_update_index', $node);

  $extra = module_invoke_all('node_search_result', $node);

   $uri = entity_uri('node', $node);
   $results[] = array(
  'link' =&gt; url($uri['path'], array_merge($uri['options'], array('absolute' =&gt; TRUE))), 
  'type' =&gt; check_plain(node_type_get_name($node)), 
  'title' =&gt; $node-&gt;title, 
  'user' =&gt; theme('username', array('account' =&gt; $node)), 
  'date' =&gt; $node-&gt;changed, 
  'node' =&gt; $node, 
  'extra' =&gt; $extra, 
  'score' =&gt; $item-&gt;calculated_score, 
  'snippet' =&gt; search_excerpt($keys, $node-&gt;rendered), 
  'language' =&gt; entity_language('node', $node),
 );
}
  return $results;
}
I don't question that the suggested answer (from NishantP) might answer the question. But the "Goto ... &amp; open taxonomy.module ..." looks like hacking this module. If you just do that, then be prepared for the issue potentially coming back in the next module upgrade (because such upgrade might wipe out your edit).

As an alternative, how about filing an issue for this module (if such issue doesn't exist already), and attach a patch to it corresponding to the suggested edit (hack). It might (and probably will) get accepted to be committed to the module in the next reease of it). From then on no more issue with future upgrades of that module. And if it doesn't get accepted, you can still use that same patch to re-apply in further module upgrades (assuming you don't have to re-roll them then).

Edit: looks like NishantP's answer is no longer there (deleted?). Not sure (yet) if that implies that I should now also delete "my" answer. Since I'm sure there was something in it like that "Goto ... &amp; open taxonomy.module ...", I'll leave my answer here for now, just in case anybody else ever has similar hacking-suggestions ...