Skip to content

Commit

Permalink
Merge pull request #749 from gitnnolabs/fix_id_oai
Browse files Browse the repository at this point in the history
Ajuste o ID para o serviço do OAI.
  • Loading branch information
gitnnolabs authored May 17, 2024
2 parents b457c26 + 2a380fc commit a3240f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions article/search_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ class ArticleOAIIndex(indexes.SearchIndex, indexes.Indexable):
The format of the data:
"item.id":1,
"item.handle":"oai:redi.anii.org.uy:20.500.12381/2671",
"item.handle":"54v7n5FBfdfC3KYFbbGWZYP",
"item.id":"54v7n5FBfdfC3KYFbbGWZYP",
"item.lastmodified":"2022-12-20T15:18:22Z",
"item.submitter":"submitter",
"item.deleted":false,
Expand Down Expand Up @@ -273,8 +274,8 @@ class ArticleOAIIndex(indexes.SearchIndex, indexes.Indexable):
"""

text = indexes.CharField(document=True, use_template=True)
id = indexes.CharField(model_attr="id", index_fieldname="item.handle", null=True)
item_id = indexes.CharField(model_attr="id", index_fieldname="item.id", null=True)
id = indexes.CharField(index_fieldname="item.handle", null=True)
item_id = indexes.CharField(index_fieldname="item.id", null=True)
updated = indexes.CharField(index_fieldname="item.lastmodified", null=True)
submitter = indexes.CharField(
model_attr="creator", index_fieldname="item.submitter", null=True
Expand Down Expand Up @@ -302,6 +303,12 @@ class ArticleOAIIndex(indexes.SearchIndex, indexes.Indexable):
null=True, index_fieldname="item.compile", use_template=True
)

def prepare_id(self, obj):
return obj.pid_v3 or obj.doi

def prepare_item_id(self, obj):
return obj.pid_v3 or obj.doi

def prepare_doi(self, obj):
if obj.doi:
return "".join([doi.value for doi in obj.doi.all()])
Expand Down
2 changes: 1 addition & 1 deletion index/data/oai/conf/managed-schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<field name="django_id" type="string" indexed="false" stored="false" multiValued="false"/>

<!-- Item always present information -->
<field name="item.id" type="pint" indexed="true" stored="true" multiValued="false" />
<field name="item.id" type="string" indexed="true" stored="true" multiValued="false" />
<field name="item.public" type="boolean" indexed="true" stored="true" multiValued="false" />
<field name="item.handle" type="string" indexed="true" stored="true" multiValued="false" />
<field name="item.collections" type="string" indexed="true" stored="true" multiValued="true" />
Expand Down

0 comments on commit a3240f1

Please sign in to comment.