Search Nodes by Username Is there any way to find node content (e.g., articles, pages, etc.) by username using Drupal's (version 7.x) core site search (i.e., the search end users can use)?

The installation that I'm working on currently indexes usernames only if they occur within the body of the node content; however, the users' respective articles will not show up.

I've attempted to write a small module to update the index to use the username (modifying this example for 7.x). I had no luck with this.

I've also attempted to write a small module that hooks into the search; however, it seems to be only accessible to the core node and user modules, which implement the hooks already.

For the time being, I have edited the core search module (in search.pages.inc) to call my small module. Then I grab the search keywords and see if they resembles an author name. If so, I grab some recent articles.

It works for now, but it's obviously not a good idea to edit the core.

Anyway, thanks for any help!
Here's my Core Drupal search based solution for the same. The code below would be responsible for indexing the node author in a custom module badly named My custom module ('my_module.module'). Most of the code is heavily inspired by the core search module's search.api.php. 

Once the module is in place ensure that its name (again My custom module) is checked in Active search modules. 

/**
 * Implements hook_search_info().
 * This ensures that the Search Content by author tab is present in your Search result
 * and available in the path site/byauthor/&lt;searchterm&gt;
 */
function my_module_search_info() {
  return array(
    'title' =&gt; 'Search Content by author',
    'path' =&gt; 'byauthor',
    'conditions callback' =&gt; 'callback_search_conditions',
  );
}


Following this click and confirm re-index content and run cron for the actual indexing
The hook_update_index is written such that for each node the author name is retrieved and stored in the search index as a type 'nodebyauthor'. 

/**
 * Implements hook_update_index().
 *
 * To actually index the nodes based on the uid
 * "Inspired" by search.api.php from drupal core search
 */
function my_module_update_index() {
  watchdog('my_module', 'entered my module update index');
  $limit = (int)variable_get('search_cron_limit', 100);
  $result = db_query_range("SELECT n.nid FROM {node} n 
            LEFT JOIN {search_dataset} d ON d.type = 'nodebyauthor' 
            AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex &lt;&gt; 0 
            ORDER BY d.reindex ASC, n.nid ASC", 0, $limit);
  foreach ($result as $node) {
    // simple query seemed a better option than loading the node and author object
    $author = db_query("SELECT `uid` FROM {node} WHERE `nid` = :nid", 
              array(':nid' =&gt; $node-&gt;nid))-&gt;fetchField();
    watchdog("my_moduleupdateidx", "Node is {$node-&gt;nid} and uid is {$author}");
    if ($author !== FALSE) {
      $author_name = db_query("SELECT `name` FROM {users} 
                     WHERE `uid` = :uid", 
                     array(':uid' =&gt; $author))-&gt;fetchField();
      search_index($node-&gt;nid, 'nodebyauthor', $author_name);
    }
  }
}


A helper hook hook_search_reset to mark content for reindexing when re-index option is triggered

/**
 * Implements hook_search_reset().
 *
 * Reset the indexed item timestamp for being reindexed on subsequent cron runs.
 */
function my_module_search_reset() {
  db_update('search_dataset')
    -&gt;fields(array('reindex' =&gt; REQUEST_TIME))
    -&gt;condition('type', 'nodebyauthor')
    -&gt;execute();
}


The hook_search_execute is where the actual newly indexed content (after enabling our custom module and running cron) will provide results based on the user when a search is triggered:

/**
 * Implements hook_search_execute().
 *
 * To provide matching node results based on the node author when searched, again blatantly copied from search.api.php
 */
function my_module_search_execute($keys = NULL, $conditions = NULL) {
  $query = db_select('search_index', 'i', 
           array('target' =&gt; 'slave'))
           -&gt;extend('SearchQuery')
           -&gt;extend('PagerDefault');
  $query-&gt;join('node', 'n', 'n.nid = i.sid');
  $query
    -&gt;condition('n.status', 1)
    -&gt;addTag('node_access')
    -&gt;searchExpression($keys, 'nodebyauthor');

  // 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);
  /*drupal_set_message((string) $query);
  drupal_set_message(var_dump($query-&gt;arguments()));
  drupal_set_message((string)$query-&gt;countQuery());*/
  // Load results.
  $find = $query
    -&gt;limit(10)
    -&gt;execute();
  $results = array();


  foreach ($find as $item) {
    // Build the node body.
    $node = node_load($item-&gt;sid);
    node_build_content($node, 'search_result');
    $node-&gt;body = drupal_render($node-&gt;content);

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

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

    $results[] = array(
      'link' =&gt; url('node/' . $item-&gt;sid, 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;body),
    );
  }
  return $results;
}




Despite being huge even with some additional search hooks missing I believe anything is better an option than hacking core. Hope this helps.