Skip to content

Commit

Permalink
Merge pull request iodepo#112 from jmckenna/name-list
Browse files Browse the repository at this point in the history
[Indexer] Handle name as a List, and handle type:Movie
  • Loading branch information
jmckenna authored Nov 30, 2023
2 parents 7f41299 + 7ba1cb5 commit 2f93f72
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions indexer/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ def genericType_toAtts(orig, rid=None):
if orig['@type'] == 'Project' or orig['@type'] == 'ResearchProject':
print('***changing type:Project to type:ResearchProject')
origType = 'ResearchProject'
#handle type:DigitalDocument as type:CreativeWork (see https://github.com/iodepo/odis-arch/issues/337 )
elif orig['@type'] == 'CreativeWork' or orig['@type'] == 'DigitalDocument':
print('***changing type:DigitalDocument to type:CreativeWork')
#handle CreativeWork subsets as type:CreativeWork (see https://github.com/iodepo/odis-arch/issues/337 )
elif orig['@type'] == 'CreativeWork' or orig['@type'] == 'DigitalDocument' or orig['@type'] == 'Movie':
print('***changing type:' + orig['@type'] + ' to type:CreativeWork')
origType = 'CreativeWork'
else:
origType = orig['@type']
Expand Down Expand Up @@ -185,14 +185,18 @@ def genericType_toAtts(orig, rid=None):
#handle case of name as list
for i in v:
pos = 0
print(i.values())
for val in i.values():
if val == "en":
listForm = list(i.values())
print('***Name: ' + listForm[pos+1])
data.append(Att(None, listForm[pos+1], k))
data.append(Att('txt', listForm[pos+1], k))
data.append(Att('txt', regions.regionForName(listForm[pos+1]), 'region'))
if isinstance(i, dict) == True:
print(i.values())
for val in i.values():
if val == "en":
listForm = list(i.values())
print('***Name: ' + listForm[pos+1])
data.append(Att(None, listForm[pos+1], k))
data.append(Att('txt', listForm[pos+1], k))
data.append(Att('txt', regions.regionForName(listForm[pos+1]), 'region'))
else:
data.append(Att(None, i, k))
data.append(Att('txt', i, k))
elif k == 'description':
if isinstance(v, list) == False:
#print('type is: ',type(v))
Expand Down

0 comments on commit 2f93f72

Please sign in to comment.