Skip to content

Commit

Permalink
Added Application to ascii folding
Browse files Browse the repository at this point in the history
  • Loading branch information
RK206 committed Nov 7, 2024
1 parent f3b1106 commit 4a9162b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
11 changes: 11 additions & 0 deletions doajtest/fixtures/v2/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ def make_update_request_source():
@staticmethod
def make_application_source():
return deepcopy(APPLICATION_SOURCE)

@staticmethod
def make_application_with_data(title=None, publisher_name=None, country=None):
application = deepcopy(APPLICATION_SOURCE)
if title:
application["bibjson"]["title"] = title
if publisher_name:
application["bibjson"]["publisher"]["name"] = publisher_name
if country:
application["bibjson"]["publisher"]["country"] = country
return application

@staticmethod
def make_many_application_sources(count=2, in_doaj=False):
Expand Down
32 changes: 32 additions & 0 deletions doajtest/unit/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,38 @@ def test_journal_query_ascii_folding_data(self):

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
.make_application_with_data(title="Kadınlarının sağlık",
publisher_name="Ankara Üniversitesi",
country="Türkiye", ))
application.save(blocking=True)
qsvc = QueryService()

# check if journal exist
res = qsvc.search('editor_query', 'suggestion', MATCH_ALL_RAW_QUERY, account=acc,
additional_parameters={})
assert res['hits']['total']["value"] == 1, res['hits']['total']["value"]

# check for title search
res = qsvc.search('editor_query', 'suggestion', raw_query("Kadinlarinin saglik"), account=acc,
additional_parameters={"ref": "fqw"})

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

# check for publisher name
res = qsvc.search('editor_query', 'suggestion', raw_query("Ankara Universitesi"), account=acc,
additional_parameters={"ref": "fqw"})

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

# check for country
res = qsvc.search('editor_query', 'suggestion', raw_query("Turkiye"), account=acc,
additional_parameters={"ref": "fqw"})

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

def test_search__invalid_from(self):
acc = models.Account(**AccountFixtureFactory.make_managing_editor_source())
acc.save(blocking=True)
Expand Down
5 changes: 5 additions & 0 deletions portality/migrate/3490_ascii_folding/migrate.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"type": "journal",
"migrate": true,
"set_alias": false
},
{
"type": "application",
"migrate": true,
"set_alias": false
}
]
}
2 changes: 1 addition & 1 deletion portality/models/v2/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class AllPublisherApplications(DomainObject):
MAPPING_OPTS = {
"dynamic": None,
"coerces": Journal.add_mapping_extensions(app.config["DATAOBJ_TO_MAPPING_DEFAULTS"]),
"exceptions": app.config["ADMIN_NOTES_SEARCH_MAPPING"],
"exceptions": {**app.config["ADMIN_NOTES_SEARCH_MAPPING"], **app.config["JOURNAL_EXCEPTION_MAPPING"]},
"additional_mappings": app.config["ADMIN_NOTES_INDEX_ONLY_FIELDS"]
}

Expand Down

0 comments on commit 4a9162b

Please sign in to comment.