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

add dedicated concordance field #480

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
9 changes: 9 additions & 0 deletions mappings/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ var schema = {
population: multiplier,
popularity: multiplier,

// concordance (indexed foreign key references)
concordance: hash,

// addendum (non-indexed supplimentary data)
addendum: hash
},
Expand All @@ -196,6 +199,12 @@ var schema = {
similarity: 'peliasDefaultSimilarity'
}
}
},{
concordance: {
path_match: 'concordance.*',
match_mapping_type: 'string',
mapping: keyword
}
},{
addendum: {
path_match: 'addendum.*',
Expand Down
15 changes: 13 additions & 2 deletions test/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,20 @@ module.exports.tests.dynamic_templates = function(test, common) {
});
t.end();
});
test('dynamic_templates: concordance', function (t) {
t.equal(typeof schema.mappings.dynamic_templates[2].concordance, 'object', 'concordance template specified');
var template = schema.mappings.dynamic_templates[2].concordance;
t.equal(template.path_match, 'concordance.*');
t.equal(template.match_mapping_type, 'string');
t.deepEqual(template.mapping, {
type: 'keyword',
doc_values: false
});
t.end();
});
test('dynamic_templates: addendum', function (t) {
t.equal(typeof schema.mappings.dynamic_templates[2].addendum, 'object', 'addendum template specified');
var template = schema.mappings.dynamic_templates[2].addendum;
t.equal(typeof schema.mappings.dynamic_templates[3].addendum, 'object', 'addendum template specified');
var template = schema.mappings.dynamic_templates[3].addendum;
t.equal(template.path_match, 'addendum.*');
t.equal(template.match_mapping_type, 'string');
t.deepEqual(template.mapping, {
Expand Down
2 changes: 1 addition & 1 deletion test/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports.tests.properties = function(test, common) {
module.exports.tests.fields = function(test, common) {
var fields = ['source', 'layer', 'name', 'phrase', 'address_parts',
'parent', 'center_point', 'shape', 'bounding_box', 'source_id', 'category',
'population', 'popularity', 'addendum'];
'population', 'popularity', 'concordance', 'addendum'];
test('fields specified', function(t) {
t.deepEqual(Object.keys(schema.properties), fields);
t.end();
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2992,6 +2992,10 @@
"type": "keyword",
"doc_values": false
},
"concordance": {
"type": "object",
"dynamic": true
},
"population": {
"type": "long",
"null_value": 0
Expand Down Expand Up @@ -3030,6 +3034,16 @@
}
}
},
{
"concordance": {
"path_match": "concordance.*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword",
"doc_values": false
}
}
},
{
"addendum": {
"path_match": "addendum.*",
Expand Down