/[drupal]/contributions/modules/apachesolr/apachesolr.module
ViewVC logotype

Diff of /contributions/modules/apachesolr/apachesolr.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.12.2.161.2.8, Thu Nov 5 17:24:43 2009 UTC revision 1.1.2.12.2.161.2.9, Fri Nov 6 09:39:34 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: apachesolr.module,v 1.1.2.12.2.161.2.7 2009/10/23 12:18:03 claudiucristea Exp $  // $Id: apachesolr.module,v 1.1.2.12.2.161.2.8 2009/11/05 17:24:43 claudiucristea Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 279  function apachesolr_clear_last_index($na Line 279  function apachesolr_clear_last_index($na
279   * Truncate and rebuild the apachesolr_search_node table, reset the apachesolr_index_last variable.   * Truncate and rebuild the apachesolr_search_node table, reset the apachesolr_index_last variable.
280   * This is the most complete way to force reindexing, or to build the indexing table for the   * This is the most complete way to force reindexing, or to build the indexing table for the
281   * first time.   * first time.
282     *
283     * @param $type
284     *   A single content type to be reindexed, leaving the others unaltered.
285   */   */
286  function apachesolr_rebuild_index_table() {  function apachesolr_rebuild_index_table($type = NULL) {
287    db_query("DELETE FROM {apachesolr_search_node}");    if (isset($type)) {
288    // Populate table      db_query("DELETE FROM {apachesolr_search_node} WHERE nid IN (SELECT nid FROM {node} WHERE type = '%s')", $type);
289    db_query("INSERT INTO {apachesolr_search_node} (nid, status, changed)      // Populate table
290              SELECT n.nid, n.status, GREATEST(n.created, n.changed, c.last_comment_timestamp) AS changed      db_query("INSERT INTO {apachesolr_search_node} (nid, status, changed)
291              FROM {node} n                SELECT n.nid, n.status, %d AS changed
292              LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid");                FROM {node} n WHERE n.type = '%s'", time(), $type);
293     // Make sure no nodes end up with a timestamp that's in the future.    }
294     $time = time();    else {
295     db_query("UPDATE {apachesolr_search_node} SET changed = %d WHERE changed > %d", $time, $time);      db_query("DELETE FROM {apachesolr_search_node}");
296     apachesolr_clear_last_index();      // Populate table
297        db_query("INSERT INTO {apachesolr_search_node} (nid, status, changed)
298                  SELECT n.nid, n.status, GREATEST(n.created, n.changed, c.last_comment_timestamp) AS changed
299                  FROM {node} n
300                  LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid");
301        // Make sure no nodes end up with a timestamp that's in the future.
302        $time = time();
303        db_query("UPDATE {apachesolr_search_node} SET changed = %d WHERE changed > %d", $time, $time);
304        apachesolr_clear_last_index();
305      }
306  }  }
307    
308  function _apachesolr_exclude_types($namespace) {  function _apachesolr_exclude_types($namespace) {

Legend:
Removed from v.1.1.2.12.2.161.2.8  
changed lines
  Added in v.1.1.2.12.2.161.2.9

  ViewVC Help
Powered by ViewVC 1.1.2