Indexing
- sir.indexing._index_entity_process_wrapper(args, live=False)[source]
Calls
sir.indexing.index_entity()withargsunpacked.- Parameters:
live (bool)
- Return type:
None or an Exception
- sir.indexing._multiprocessed_import(entity_names, live=False, entities=None)[source]
Does the real work to import all entities with
entity_namein multiple processes via themultiprocessingmodule.When
liveis True, it means, we are live indexing documents with ids in theentitiesdict, otherwise it reindexes the entire table for entities inentity_names.
- sir.indexing.index_entity(session, entity_name, bounds, data_queue)[source]
Retrieve rows for a single entity type identified by
entity_name, convert them to a dict withsir.indexing.query_result_to_dict()and put the dicts intoqueue.- Parameters:
session (sqlalchemy.orm.Session)
entity_name (str)
data_queue (Queue.Queue)
- sir.indexing.live_index(entities)[source]
Reindex all documents in``entities`` in multiple processes via the
multiprocessingmodule.
- sir.indexing.live_index_entity(session, entity_name, ids, data_queue)[source]
Retrieve rows for a single entity type identified by
entity_name, convert them to a dict withsir.indexing.query_result_to_dict()and put the dicts intoqueue.- Parameters:
session (sqlalchemy.orm.Session)
entity_name (str)
ids ([int])
data_queue (Queue.Queue)
- sir.indexing.queue_to_solr(queue, batch_size, entity_name)[source]
Read
dictobjects fromqueueand send them to the Solr server behindsolr_connectionin batches ofbatch_size.- Parameters:
queue (multiprocessing.Queue)
batch_size (int)
entity_name (str)
- sir.indexing.reindex(args)[source]
Reindexes all entity types in args[“entity_type”].
If no types are specified, all known entities will be reindexed.
- Parameters:
args (dict) – A dictionary with a key named
entities.