Combine hook_search_execute

I have hook for user_search_execute and node_search_execute for both user and nodes but i want to merge both into mymoduel_search_execute but only node_search_execute uses index not user_search_execute like below :-

     /* node search execute */      function node_search_execute($keys = NULL, $conditions = NULL) {         // Build matching conditions         $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('SearchQuery')->extend('PagerDefault');         $query->join('node', 'n', 'n.nid = i.sid');         $query             ->condition('n.status', 1)             ->addTag('node_access')             ->searchExpression($keys, 'node');          // Insert special keywords.         $query->setOption('type', 'n.type');         $query->setOption('language', 'n.language');         if ($query->setOption('term', 'ti.tid')) {             $query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');         }         // Only continue if the first pass query matches.         if (!$query->executeFirstPass()) {             return array();         }          // Add the ranking expressions.         _node_rankings($query);          // Load results.         $find = $query             ->limit(10)             ->execute();         $results = array();         foreach ($find as $item) {             // Render the node.             $node = node_load($item->sid);             $build = node_view($node, 'search_result');             unset($build['#theme']);             $node->rendered = drupal_render($build);              // Fetch comments for snippet.             $node->rendered .= ' ' . module_invoke('comment', 'node_update_index', $node);              $extra = module_invoke_all('node_search_result', $node);              $uri = entity_uri('node', $node);             $results[] = array(                 'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE))),                 'type' => check_plain(node_type_get_name($node)),                 'title' => $node->title,                 'user' => theme('username', array('account' => $node)),                 'date' => $node->changed,                 'node' => $node,                 'extra' => $extra,                 'score' => $item->calculated_score,                 'snippet' => search_excerpt($keys, $node->rendered),                 'language' => entity_language('node', $node),             );         }         return $results;     } 

i want to combine both queries into one even search url anything else.

please help..

Sponsored by SupremePR
This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Combine hook_search_execute

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.