Browse Source

Add helpful comments in various query parser locations

pull/347/head
Julian Simioni 9 years ago
parent
commit
8f1c8f4d89
  1. 4
      helper/query_parser.js
  2. 4
      helper/types.js

4
helper/query_parser.js

@ -8,6 +8,10 @@ var logger = require('pelias-logger').get('api');
module.exports = {};
/*
* For performance, and to prefer POI and admin records, express a preference
* to only search coarse layers on very short text inputs.
*/
module.exports.get_layers = function get_layers(query) {
if (query.length <= 3 ) {
// no address parsing required

4
helper/types.js

@ -2,12 +2,14 @@ var type_mapping = require( '../helper/type_mapping' );
var _ = require('lodash');
/**
* Combine all types and determine the unique subset
* Different parts of the code express "preferences" for which Elasticsearch types are going to be searched
* This method decides how to combine all the preferences.
*
* @param {Array} clean_types
* @returns {Array}
*/
module.exports = function calculate_types(clean_types) {
//Check that at least one preference of types is defined
if (!clean_types || !(clean_types.from_layers || clean_types.from_sources || clean_types.from_address_parser)) {
throw new Error('clean_types should not be null or undefined');
}

Loading…
Cancel
Save