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

WIP: transliteration #341

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
65 changes: 65 additions & 0 deletions integration/address_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,71 @@ module.exports.tests.venue_vs_address = function(test, common){
});
};

module.exports.tests.transliteration = function(test, common){
test( 'transliteration', function(t){

var suite = new elastictest.Suite( common.clientOpts, { schema: schema } );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index some docs
suite.action( function( done ){
suite.client.index({
index: suite.props.index, type: 'test',
id: '1', body: { address_parts: {
street: 'זבולון'
}}
}, done );
});

// search in Hebrew
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: 'test',
body: { query: { bool: { must: [
{ match: { 'address_parts.street': 'זבולון' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( res.hits.total, 1, 'match street name' );
done();
});
});

// search transliteration
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: 'test',
body: { query: { bool: { must: [
{ match: { 'address_parts.street': 'zvulun' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( res.hits.total, 1, 'match street name' );
done();
});
});

// search transliteration
suite.assert( function( done ){
suite.client.search({
index: suite.props.index,
type: 'test',
body: { query: { bool: { must: [
{ match: { 'address_parts.street': 'zevulon' } }
]}}}
}, function( err, res ){
t.equal( err, undefined );
t.equal( res.hits.total, 1, 'match street name' );
done();
});
});

suite.run( t.end );
});
};

module.exports.all = function (tape, common) {

function test(name, testFunction) {
Expand Down
5 changes: 5 additions & 0 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function generate(){
"filter": [
"lowercase",
"icu_folding",
"peliasICUTransform",
"remove_duplicate_spaces",
"custom_street",
].concat( synonyms.street_suffix_contractions.map( function( synonym ){
Expand All @@ -165,6 +166,10 @@ function generate(){
}
},
"filter" : {
"peliasICUTransform": {
"type": "icu_transform",
"id": "Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC"
},
"notnull" :{
"type" : "length",
"min" : 1
Expand Down