def update_solr(docs): solr = SolrWriter("localhost:8983") for doc in docs: # temp fix for handling already processed data doc = dict((k, v) for k, v in doc.items() if v is not None) if isinstance(doc.get("ia_collections_id"), str): doc['ia_collections_id'] = doc['ia_collections_id'].split(";") fix_subject_key(doc, 'subject_key', '/subjects/') fix_subject_key(doc, 'place_key', '/subjects/place:') fix_subject_key(doc, 'person_key', '/subjects/person:') fix_subject_key(doc, 'time_key', '/subjects/time:') solr.update(doc) solr.commit()
def update_solr(docs): solr = SolrWriter("localhost:8983") for doc in docs: # temp fix for handling already processed data doc = dict((k, v) for k, v in doc.items() if v is not None) if isinstance(doc.get("ia_collections_id"), str): doc['ia_collections_id'] = doc['ia_collections_id'].split(";") fix_subject_key(doc, 'subject_key', '/subjects/') fix_subject_key(doc, 'place_key', '/subjects/place:') fix_subject_key(doc, 'person_key', '/subjects/person:') fix_subject_key(doc, 'time_key', '/subjects/time:') system_subjects = ['subject:Protected DAISY', 'subject:Accessible book', 'subject:In library', 'subject:Lending library'] doc['subject_facet'] = [s for s in doc['subject_facet'] if s not in system_subjects] solr.update(doc) solr.commit()
def update_solr(docs): # stats_solr is defined in olsystem etc/openlibrary.yml solr = SolrWriter(config.stats_solr or "localhost:8983") for doc in docs: # temp fix for handling already processed data doc = {k: v for k, v in doc.items() if v is not None} if isinstance(doc.get("ia_collections_id"), str): doc['ia_collections_id'] = doc['ia_collections_id'].split(";") fix_subject_key(doc, 'subject_key', '/subjects/') fix_subject_key(doc, 'place_key', '/subjects/place:') fix_subject_key(doc, 'person_key', '/subjects/person:') fix_subject_key(doc, 'time_key', '/subjects/time:') system_subjects = [ 'subject:Protected DAISY', 'subject:Accessible book', 'subject:In library', 'subject:Lending library', ] doc['subject_facet'] = [ s for s in doc['subject_facet'] if s not in system_subjects ] solr.update(doc) solr.commit()