-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
indexing: update mef persons mapping
* Adds analyzer on biographical_information, preferred_name_for_person, authorized_access_point_representing_a_person and variant_name_for_person fields. Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
- Loading branch information
1 parent
280aa05
commit 3a71711
Showing
4 changed files
with
102 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1253,4 +1253,4 @@ | |
"transaction_location_pid": "loc1", | ||
"transaction_user_pid": "ptrn2" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of RERO ILS. | ||
# Copyright (C) 2017 RERO. | ||
# | ||
# RERO ILS is free software; you can redistribute it | ||
# and/or modify it under the terms of the GNU General Public License as | ||
# published by the Free Software Foundation; either version 2 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# RERO ILS is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with RERO ILS; if not, write to the | ||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
# MA 02111-1307, USA. | ||
# | ||
# In applying this license, RERO does not | ||
# waive the privileges and immunities granted to it by virtue of its status | ||
# as an Intergovernmental Organization or submit itself to any jurisdiction. | ||
|
||
"""Mef Persons Record tests.""" | ||
|
||
from utils import get_mapping | ||
|
||
from rero_ils.modules.mef_persons.api import MefPerson, MefPersonsSearch | ||
|
||
|
||
def test_mef_persons_search_mapping( | ||
app, mef_person | ||
): | ||
"""Test Mef Persons search mapping.""" | ||
search = MefPersonsSearch() | ||
|
||
c = search.query('query_string', query='ordonné prêtre').count() | ||
assert c == 1 | ||
|
||
c = search.query('query_string', query='ordonne pretre').count() | ||
assert c == 1 | ||
|
||
c = search.query( | ||
'match', | ||
**{'bnf.biographical_information': 'ordonné'}).\ | ||
count() | ||
assert c == 1 | ||
|
||
c = search.query( | ||
'match', | ||
**{'bnf.biographical_information': 'ordonne'}).\ | ||
count() | ||
assert c == 1 | ||
|
||
c = search.query( | ||
'match', | ||
**{'gnd.preferred_name_for_person': 'Arnoudt'}).\ | ||
count() | ||
assert c == 1 | ||
|
||
c = search.query( | ||
'match', | ||
**{'gnd.variant_name_for_person': 'Arnoudt'}).\ | ||
count() | ||
assert c == 1 | ||
|
||
|
||
def test_mef_person_es_mapping(es_clear, db, mef_person_data_tmp): | ||
"""Test mef elasticsearch mapping.""" | ||
search = MefPersonsSearch() | ||
mapping = get_mapping(search.Meta.index) | ||
assert mapping | ||
MefPerson.create( | ||
mef_person_data_tmp, | ||
dbcommit=True, | ||
reindex=True, | ||
delete_pid=True | ||
) | ||
assert mapping == get_mapping(search.Meta.index) |