def reset_model_catalog():
    """
    Deletes temporary documents from previous tests.
    They should be cleaned by abort() but just in case
    """
    model_index = zope.component.createObject('ModelIndex', get_solr_config(test=True))
    model_index.unindex_search(SearchParams(query="NOT tx_state:0"))
    def __init__(self, error_queue, idx, worker_count, parent_queue, counter, semaphore, cond, cancel, terminator,
                 fields=None, logtoggle=None):
        super(ReindexProcess, self).__init__()

        self.error_queue = error_queue
        self.idx = idx
        self.worker_count = worker_count
        self.parent_queue = parent_queue
        self.counter = counter

        self.semaphore = semaphore
        self.cond = cond
        self.cancel = cancel
        self.terminator = terminator
        self.fields = fields
        self.logtoggle = logtoggle

        self.semaphore_acquired = False

        self._batch = []

        zsb = ZenScriptBase(connect=True, should_log=False)
        self.dmd = zsb.dmd
        self._db = zsb.db
        self.index_client = zope.component.createObject('ModelIndex', get_solr_config())
def init_model_catalog(collection_name=ZENOSS_MODEL_COLLECTION_NAME):
    index_client = zope.component.createObject('ModelIndex', get_solr_config(), collection_name)
    config = {}
    config["collection_name"] = collection_name
    config["collection_config_name"] = collection_name
    config["num_shards"] = 1
    index_client.init(config)
    return index_client
def init_model_catalog(collection_name=ZENOSS_MODEL_COLLECTION_NAME):
    index_client = zope.component.createObject('ModelIndex', get_solr_config(),
                                               collection_name)
    config = {}
    config["collection_name"] = collection_name
    config["collection_config_name"] = collection_name
    config["num_shards"] = 1
    index_client.init(config)
    return index_client
    def __init__(self,
                 error_queue,
                 idx,
                 worker_count,
                 parent_queue,
                 counter,
                 semaphore,
                 cond,
                 cancel,
                 terminator,
                 fields=None,
                 logtoggle=None):
        super(ReindexProcess, self).__init__()

        self.error_queue = error_queue
        self.idx = idx
        self.worker_count = worker_count
        self.parent_queue = parent_queue
        self.counter = counter

        self.semaphore = semaphore
        self.cond = cond
        self.cancel = cancel
        self.terminator = terminator
        self.fields = fields
        self.logtoggle = logtoggle

        self.semaphore_acquired = False

        self._batch = []

        zsb = ZenScriptBase(connect=True, should_log=False)
        self.dmd = zsb.dmd
        self._db = zsb.db
        self.index_client = zope.component.createObject(
            'ModelIndex', get_solr_config())
 def __init__(self, dmd=None):
     self.model_index = zope.component.createObject('ModelIndex',
                                                    get_solr_config())
     self.dmd = dmd
def collection_exists(collection_name=ZENOSS_MODEL_COLLECTION_NAME):
    index_client = zope.component.createObject('ModelIndex', get_solr_config(), collection_name)
    return collection_name in index_client.get_collections()
def collection_exists(collection_name=ZENOSS_MODEL_COLLECTION_NAME):
    index_client = zope.component.createObject('ModelIndex', get_solr_config(),
                                               collection_name)
    return collection_name in index_client.get_collections()
 def __init__(self, dmd=None):
     self.model_index = zope.component.createObject('ModelIndex', get_solr_config())
     self.dmd = dmd
 def __init__(self, dmd):
     self.dmd = dmd
     self.indexer = zope.component.createObject('ModelIndexer', get_solr_config())
 def __init__(self, indexer=None, batch_size=DEFAULT_BATCH_SIZE):
     self.BATCH_SIZE = batch_size
     self.indexer = indexer
     if not self.indexer:
         self.indexer = zope.component.createObject('ModelIndexer', get_solr_config())
def delete_all_documents():

    query = {"uid" : "*"}
    search_params=SearchParams(query)
    searcher = zope.component.createObject('ModelSearcher', get_solr_config())
    searcher.unindex_search(search_params)