the search service as it stands either returns far too much data - or (in the simple search) doesn't provide the node ID which is fairly critical to actually do anything with the returned data, I've modified the code slightly so that this gets returned:

//lines 12-39 of search_service.inc
function search_service_nodes($keys, $simple = FALSE) {
  // define standard keys for simple set
  // added 'node' into this array
  $stdkeys = array('node', 'link', 'type', 'title', 'user', 'date', 'snippet');


  // invoke the search hook to generate results
  $results = module_invoke('node', 'search', 'search', $keys);
  if ($results and is_array($results) and count($results)) {
    // if simple results requested, remove extra data
    if ($simple) {
      $num = count($results);
      for ($i = 0; $i<$num; $i++) {
        $keys = array_keys($results[$i]);
        foreach ($keys as $key) {
	  // only add the node id (nid)
	  if ($key == 'node'){
	    $results[$i][$key] = $results[$i]['node']->nid;
	  }
          if (!in_array($key, $stdkeys)) {
            unset($results[$i][$key]);
          }
        }
      }
    }
    return $results;
  }
  return services_error(t('Search returned no results.'));
}

Comments

marcingy’s picture

Status: Active » Fixed
marcingy’s picture

Status: Fixed » Closed (fixed)