How to use pelias-config - 10 common examples

To help you get started, we’ve selected a few pelias-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pelias / schema / integration / dynamic_templates.js View on Github external
// http://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates

const elastictest = require('elastictest');
const config = require('pelias-config').generate();

module.exports.tests = {};

module.exports.tests.dynamic_templates_name = function(test, common){
  test( 'document->name', nameAssertion( 'peliasIndexOneEdgeGram', common ) );
};

module.exports.tests.dynamic_templates_phrase = function(test, common){
  test( 'document->phrase', phraseAssertion( 'peliasPhrase', common ) );
};

module.exports.tests.dynamic_templates_addendum = function(test, common){
  test( 'addendum', addendumAssertion( 'wikipedia', JSON.stringify({ slug: 'Wikipedia' }), common ) );
};

module.exports.all = function (tape, common) {
github pelias / whosonfirst / import.js View on Github external
var peliasConfig = require( 'pelias-config' ).generate(require('./schema'));
var readStreamModule = require('./src/readStream');
var importStream = require('./src/importStream');
var peliasDbclient = require( 'pelias-dbclient' );
var peliasDocGenerators = require('./src/peliasDocGenerators');
var hierarchyFinder = require('./src/hierarchyFinder');
var bundles = require('./src/bundleList');

const logger = require( 'pelias-logger' ).get( 'whosonfirst' );

// a cache of only admin records, to be used to fill the hierarchy
// of other, lower admin records as well as venues
var wofAdminRecords = {};

bundles.generateBundleList((err, bundlesToImport) => {

  if (err) {
github pelias / whosonfirst / utils / sqlite_extract_data.js View on Github external
function extract(options, callback){

  // load configuration variables
  const config = require('pelias-config').generate(require('../schema')).imports.whosonfirst;

  // location of data and meta dirs
  const metaDir = path.join(config.datapath, 'meta');
  const dataDir = path.join(config.datapath, 'data');
  const sqliteDir = path.join(config.datapath, 'sqlite');

  // unlink (truncate meta and data dirs)
  if( options && true === options.unlink ){
    fs.removeSync(metaDir);
    fs.removeSync(dataDir);
  }

  // ensure required directory structure exists
  fs.ensureDirSync(metaDir);
  fs.ensureDirSync(dataDir);
  fs.ensureDirSync(sqliteDir);
github pelias / openstreetmap / stream / pbf.js View on Github external
/**
  The pbf parser is responsible for configuring and executing a pbf parser and
  returning a valid readable stream.
**/

var fs = require('fs'),
    pbf2json = require('pbf2json'),
    settings = require('pelias-config').generate(require('../schema')),
    features = require('../config/features'),
    path = require('path');

// Create a new pbf parser stream
function createPbfStream(opts){

  var conf = config(opts);

  validatePath( conf.file, 'failed to stat pbf file: ' + conf.file );
  validatePath( conf.leveldb, 'failed to stat leveldb path: ' + conf.leveldb );
  validateTags( conf.tags );

  return pbf2json.createReadStream(conf);
}

// Generate configuration options for pbf2json, apply default
github pelias / api / query / search_pelias_parser.js View on Github external
const _ = require('lodash');
const peliasQuery = require('pelias-query');
const defaults = require('./search_defaults');
const textParser = require('./text_parser_pelias');
const config = require('pelias-config').generate().api;

var placeTypes = require('../helper/placeTypes');
var views = { custom_boosts: require('./view/boost_sources_and_layers') };

// region_a is also an admin field which can be identified by
// the pelias_parser. this functionality was inherited from the
// previous parser we used prior to the creation of pelias_parser.
var adminFields = placeTypes.concat(['region_a']);

//------------------------------
// general-purpose search query
//------------------------------
var query = new peliasQuery.layout.FilteredBooleanQuery();

// mandatory matches
query.score( peliasQuery.view.ngrams, 'must' );
github pelias / schema / test / compile.js View on Github external
const _ = require('lodash');
const path = require('path');
const schema = require('../');
const fixture = require('./fixtures/expected.json');
const config = require('pelias-config').generate();

const forEachDeep = (obj, cb) =>
  _.forEach(obj, (val, key) => {
    cb(val, key);
    if (_.isPlainObject(val) || _.isArray(val)){
      forEachDeep(val, cb);
    }
  });

module.exports.tests = {};

module.exports.tests.compile = function(test, common) {
  test('valid schema file', function(t) {
    t.equal(typeof schema, 'object', 'schema generated');
    t.equal(Object.keys(schema).length>0, true, 'schema has body');
    t.end();
github pelias / api / test / unit / query / autocomplete.js View on Github external
generate: function() {
      return realPeliasConfig.generateCustom(customConfig);
    }
  };
github pelias / api / test / unit / query / autocomplete_with_custom_boosts.js View on Github external
generate: function() {
        return realPeliasConfig.generateCustom(custom_config);
      }
    };
github pelias / api / test / unit / query / search_original.js View on Github external
generate: function() {
    return realPeliasConfig.defaults;
  }
};
github pelias / api / test / unit / query / autocomplete_token_matching_permutations.js View on Github external
generate: function() {
    return realPeliasConfig.generateDefaults();
  }
};

pelias-config

Configuration settings for Pelias

MIT
Latest version published 9 months ago

Package Health Score

59 / 100
Full package analysis