Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove variant names from index #529

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/extractFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ const population_hierarchy = [
// note the '%s' is replaced by a language code
const NAME_ALIAS_FIELDS = [
'name:%s_x_preferred',
'name:%s_x_variant',
'label:%s_x_preferred_longname',
'label:%s_x_preferred'
];

const WOF_NAMES_REGEX = /^(name|label):[a-z]{3}_x_(preferred|variant)$/;
const WOF_NAMES_REGEX = /^(name|label):[a-z]{3}_x_preferred$/;

// this function is used to verify that a US county QS altname is available
function isUsCounty(base_record, wof_country, qs_a2_alt) {
Expand Down
8 changes: 3 additions & 5 deletions test/components/extractFieldsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ tape('name alias tests', (test) => {
}
}];

const expected_name_aliases = ['preferred1', 'preferred2', 'variant1', 'variant2', 'englabel1', 'englabel2'];
const expected_name_aliases = ['preferred1', 'preferred2', 'englabel1', 'englabel2'];

test_stream(input, extractFields.create(), function (err, actual) {
t.deepEqual(actual[0].name_aliases, expected_name_aliases, 'name aliases populated from preferred and variant fields');
Expand All @@ -974,7 +974,6 @@ tape('name alias tests', (test) => {

const expected_name_aliases = [
'preferred1', 'preferred2',
'variant1', 'variant2',
'spalabel1', 'spalabel2',
'fralabel1', 'fralabel2',
'englabel1', 'englabel2'
Expand Down Expand Up @@ -1003,12 +1002,11 @@ tape('multi-lang index test', (test) => {

const expected_name_langs = {
'en': ['preferredENG1'],
'fr': ['preferredFRA1', 'preferredFRA2'],
'es': ['variantSPA1', 'variantSPA2']
'fr': ['preferredFRA1', 'preferredFRA2']
};

test_stream(input, extractFields.create(), function (err, actual) {
t.deepEqual(actual[0].name_langs, expected_name_langs, 'name langs populated from fr preferred and SPA variant fields');
t.deepEqual(actual[0].name_langs, expected_name_langs, 'name langs populated from fr preferred fields');
t.end();
});
});
Expand Down