Changeset 2537


Ignore:
Timestamp:
Dec 4, 2011, 4:30:12 PM (9 years ago)
Author:
komodo
Message:

complements adaptations solr from ND

Location:
cpc/branches/senat/project
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpc/branches/senat/project/bin/indexSolr

    r1998 r2537  
    44. $(echo $0 | sed 's/[^\/]*$//')db.inc
    55
     6#CRASHSTATUS
     7STATUSFILE="/tmp/indexSolr.tomcatcrash.status"
     8if test ! -e $STATUSFILE ;
     9then
     10    echo "0" > $STATUSFILE
     11fi
     12STATUS=`cat $STATUSFILE`
     13STATUS=$(($STATUS + 1))
    614#LOCK
    715LOCK="/tmp/indexSolr.bash.lock"
     
    1018    if test ! -e /proc/$(cat $LOCK) ;
    1119    then
    12         echo "WARNING : l'indexation solr lockée alors que son processus ne tourne plus..."
    13         echo "\t suppression du fichier...";
     20        echo "WARNING : l'indexation solr est lockée alors que son processus ne tourne plus..."
     21        echo " suppression du fichier (tentative n°$STATUS)...";
    1422        rm $LOCK
     23        if [ $STATUS -ge 4 ]; then
     24            echo "trying to restart Tomcat"
     25            sudo /etc/init.d/tomcat5.5 restart > /tmp/log-restart-tomcat 2>&1
     26            cat /tmp/log-restart-tomcat
     27            STATUS="0"
     28        fi
     29        echo "$STATUS" > $STATUSFILE
    1530        exit 1;
    1631    fi
    17 #     echo Script locké par $(cat $LOCK) : $LOCK
    18 #        ps aux | grep "php symfony index:Solr" | grep -v grep > /dev/null
    19 #        if [[ $? -eq 1 ]]; then echo "WARNING : l'indexation solr semble lockée mais ne pas tourner"; fi
    2032    exit 1;
    2133fi
     
    3850#echo Fin Indexation
    3951#date
    40 
     52echo "0" > $STATUSFILE
    4153rm $LOCK ;
  • cpc/branches/senat/project/lib/task/indexSolrTask.class.php

    r2040 r2537  
    2323    $this->addOption('pages', null, sfCommandOption::PARAMETER_OPTIONAL, 'Index static pages (=no|yes no default)', 'no');
    2424    $this->addOption('removePages', null, sfCommandOption::PARAMETER_OPTIONAL, 'remove indexed static pages(=no|yes no default)', 'no');
     25    $this->addOption('verbose', null, sfCommandOption::PARAMETER_OPTIONAL, 'Print the indexed object ID (=no|yes no default)', 'no');
    2526
    2627    $this->file_conf = sys_get_temp_dir().DIRECTORY_SEPARATOR."reindex_slor.db";
     
    8081
    8182    if ($options['all'] == 'no') {
    82       $solr->updateFromCommands();
     83      $solr->updateFromCommands($options['verbose'] == 'yes');
    8384      return;
    8485    }
    8586
    86     foreach(array("Parlementaire", "Organisme", "Section", "Intervention", "Amendement", "Question", "Citoyen", "Commentaire", "Texteloi") as $table) {
     87//    foreach(array("Parlementaire", "Organisme", "Section", "Intervention", "Amendement", "Question", "Citoyen", "Commentaire", "Texteloi") as $table) {
     88    foreach(array("Parlementaire", "Organisme") as $table) {
    8789      while (1) {
    8890        $q = Doctrine::getTable($table)
     
    103105          $this->state[$table] = $o->id;
    104106        }
    105         $solr->updateFromCommands();
     107        $solr->updateFromCommands($options['verbose'] == 'yes');
    106108        $this->writeState();
    107109      }
Note: See TracChangeset for help on using the changeset viewer.