Пример #1
0
    def command(self):
        super(SolrCommand, self).command()

        if len(self.args) < 1:
            SolrCommand.parser.print_help()
            return 1

        cmd = self.args[0]

        from openspending.lib import solr_util as solr

        if cmd == 'load':
            solr.build_index(self.args[1])
        elif cmd == 'delete':
            solr.drop_index(self.args[1])
        elif cmd == 'optimize':
            solr.optimize()
        elif cmd == 'clean':
            s = solr.get_connection()
            s.delete_query('*:*')
            s.commit()
        else:
            raise self.BadCommand("Subcommand '%s' not recognized " \
                                  "by 'solr' command!" % cmd)
Пример #2
0
def optimize():
    solr.optimize()
    return 0
Пример #3
0
def optimize():
    solr.optimize()
    return 0