Skip to content

Commit

Permalink
fix(wip): Working on migration problems
Browse files Browse the repository at this point in the history
  • Loading branch information
monotasker committed Oct 30, 2024
1 parent 4100e84 commit 87ccd77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion invenio_record_importer_kcworks/record_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
StatsFabricator,
AggregationFabricator,
)
from invenio_search.proxies import current_search_client
import itertools
import json
from simplejson.errors import JSONDecodeError as SimpleJSONDecodeError
Expand Down Expand Up @@ -216,7 +217,6 @@ def create_invenio_record(
f"query: q=f'pids.doi.identifier:{doi_for_query[0]}/"
f"{doi_for_query[1]}'"
)
from invenio_search.proxies import current_search_client

same_doi = current_search_client.search(
index="kcworks-rdmrecords",
Expand Down
13 changes: 12 additions & 1 deletion invenio_record_importer_kcworks/services/communities.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,18 @@ def add_record_to_group_collections(
record_source,
commons_group_id=group_id,
)
coll_records = coll_search.to_dict()["hits"]["hits"]

coll_search = current_search_client.search(
index="kcworks-communities",
q=f'custom_fields.kcr\:commons_group_id:"{group_id}"',
)
coll_records = coll_search["hits"]["hits"]
coll_records = [
current_communities.service.read(
system_identity, id_=c["_source"]["id"]
).to_dict()
for c in coll_records
]
# NOTE: Don't check for identical group name because
# sometimes the group name has changed since the record
# was created
Expand Down

0 comments on commit 87ccd77

Please sign in to comment.