def run(): indexerConfig = IndexerConfiguration() indexerConfig.load() try: try: indexer = Indexer(indexerConfig) except MaayAuthenticationError, exc: print "AuthenticationError:", exc sys.exit(1) indexer.start()
# WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. """Utility script to clean the database. This forces full reindexation on the following indexer run """ __revision__ = '$Id$' from maay.configuration import IndexerConfiguration from logilab.common.db import get_dbapi_compliant_module config = IndexerConfiguration() config.load() dbapiMod = get_dbapi_compliant_module('mysql') connection = dbapiMod.connect(host=config.host, database='maay', user=config.user, password=config.password, unicode=True) cursor = connection.cursor() for table in ('nodes', 'document_providers', 'documents', 'document_scores', 'words', 'files', 'node_interests'): nrows = cursor.execute('DELETE FROM %s;' % table) print "Deleted %d rows from table %s" % (nrows, table) connection.commit()