Skip to content

Commit

Permalink
Added alternative title for ascii folding
Browse files Browse the repository at this point in the history
  • Loading branch information
RK206 committed Dec 11, 2024
1 parent 4a9162b commit 5ddcd5b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
17 changes: 10 additions & 7 deletions doajtest/fixtures/v2/journals.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ def make_journal_form_info():
return deepcopy(JOURNAL_FORM_EXPANDED)

@staticmethod
def make_journal_with_data(title=None, publisher_name=None, country=None, in_doaj=True):
def make_journal_with_data(**data):
journal = deepcopy(JOURNAL_SOURCE)
in_doaj = data['in_doaj'] if'in_doaj' in data else True
journal['admin']['in_doaj'] = in_doaj
if title:
journal["bibjson"]["title"] = title
if publisher_name:
journal["bibjson"]["publisher"]["name"] = publisher_name
if country:
journal["bibjson"]["publisher"]["country"] = country
if 'title' in data:
journal["bibjson"]["title"] = data['title']
if 'publisher_name' in data:
journal["bibjson"]["publisher"]["name"] = data['publisher_name']
if 'country' in data:
journal["bibjson"]["publisher"]["country"] = data['country']
if 'alternative_title' in data:
journal["bibjson"]["alternative_title"] = data['alternative_title']
return journal

@staticmethod
Expand Down
9 changes: 8 additions & 1 deletion doajtest/unit/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ def test_journal_query_ascii_folding_data(self):
self.journal = models.Journal(**JournalFixtureFactory
.make_journal_with_data(title="Kadınlarının sağlık",
publisher_name="Ankara Üniversitesi",
country="Türkiye", ))
country="Türkiye",
alternative_title="Dirasat: Shariía and Law Sciences"))
self.journal.save(blocking=True)
qsvc = QueryService()

Expand All @@ -725,6 +726,12 @@ def test_journal_query_ascii_folding_data(self):

assert res['hits']['total']["value"] == 1, res['hits']['total']["value"]

# check alternative title
res = qsvc.search('query', 'journal', raw_query("Shariia"),
account=None, additional_parameters={})

assert res['hits']['total']["value"] == 1, res['hits']['total']["value"]

def test_application_query_ascii_folding_data(self):
acc = models.Account(**AccountFixtureFactory.make_managing_editor_source())
application = models.Application(**ApplicationFixtureFactory
Expand Down
4 changes: 3 additions & 1 deletion portality/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,10 @@

JOURNAL_EXCEPTION_MAPPING = {
"bibjson.title" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED},
"bibjson.alternative_title" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED},
"bibjson.publisher.name" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED},
"index.country" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED}
"index.country" : {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED},
"index.title": {**DATAOBJ_TO_MAPPING_DEFAULTS["unicode"], **ASCII_FOLDED}
}

ARTICLE_EXCEPTION_MAPPING = {
Expand Down

0 comments on commit 5ddcd5b

Please sign in to comment.