Example #1
0
    def handle(self, *args, **kwargs):
        """
        Note that we defer model validation until after we've run autodiscover.
        This means we can call with ensure_dbs_exist=False (which is sticky),
        so that we don't get an error for not having a mapping in the database
        for anything that hasn't been indexed yet.
        """

        searchify.autodiscover(ensure_dbs_exist=False)
        self.validate()
        searchify.reindex(args)
Example #2
0
    def show_config(self, indices, verbose_out):
        searchify.autodiscover(verbose=verbose_out, ensure_dbs_exist=False)
        index_models = searchify.index._index_models
        if not indices:
            indices = index_models.keys()

        for indexname in indices:
            self.stdout.write("Configuration for index %r\n" % indexname)
            for model in index_models[indexname]:
                self.stdout.write("From model: %s\n" % model)

                indexer = searchify.utils.get_indexer(model)
                for field, config in sorted(indexer.get_configuration().items()):
                    self.stdout.write(" - %s:\n" % field)
                    for k, v in sorted(config.items()):
                        self.stdout.write("     %s: %s\n" % (k , v))

                if verbose_out:
                    verbose_out.write("Stored mapping:\n%s\n" %
                            pprint.pformat(indexer.get_current_mapping()))
                self.stdout.write("\n")