Skip to content

Commit

Permalink
Merge pull request #154 from pelias/blacklist-stream
Browse files Browse the repository at this point in the history
feat(blacklist-stream): allow excluding documents via GID blacklist
  • Loading branch information
orangejulius authored Jan 19, 2019
2 parents e180af0 + da6ca8b commit b87df10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"lodash": "^4.17.4",
"lower-case": "^1.1.4",
"morgan": "^1.9.0",
"pelias-blacklist-stream": "^1.1.0",
"pelias-logger": "^1.2.1",
"remove-accents": "^0.4.0",
"require-dir": "^1.0.0",
Expand Down
6 changes: 6 additions & 0 deletions prototype/wof.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// plugin for whosonfirst
const _ = require('lodash'),
dir = require('require-dir'),
util = require('util'),
blacklist = require('pelias-blacklist-stream/loader')(),
analysis = require('../lib/analysis'),
language = dir('../config/language');

Expand All @@ -18,6 +20,10 @@ function insertWofRecord( wof, next ){
// sanity check; because WOF
if( !isValidWofRecord( id, wof ) ) { return next(); }

// enforce pelias/blacklist-stream exclusions
let peliasGID = util.format('whosonfirst:%s:%d', wof['wof:placetype'], id);
if( blacklist && blacklist.hasOwnProperty( peliasGID ) ) { return next(); }

// --- document which will be saved in the doc store ---

const doc = {
Expand Down

0 comments on commit b87df10

Please sign in to comment.