<commit_before>
// Reverse GeoCoding geo_bounding_box Query
// @ref: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-filter.html

var baseQuery = require('./reverse_geo_base');

module.exports = function( centroid, opts ){

  if( !opts ){ opts = {}; }

  var options = {
    top   : Number( opts.bbox.top ).toFixed(2),   // @note: make filter cachable
    right : Number( opts.bbox.right ).toFixed(2), // precision max ~1.113km off
    bottom: Number( opts.bbox.bottom ).toFixed(2),
    left  : Number( opts.bbox.left ).toFixed(2),
    size: opts.size || 1,
    field: opts.field || 'center_point'
  };

  var query = baseQuery( centroid, options );

  var filter = {
    'geo_bounding_box' : {
      '_cache': true // Speed up duplicate queries. Memory impact?
    }
  };

  filter.geo_bounding_box[ options.field ] = {<commit_msg>making centroid optional with geo_bbox<commit_after>
// Reverse GeoCoding geo_bounding_box Query
// @ref: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-filter.html

var baseQuery = require('./geo_base');
var baseQueryWithCentroid = require('./reverse_geo_base');

module.exports = function( centroid, opts ){

  if( !opts ){ opts = {}; }

  var options = {
    top   : Number( opts.bbox.top ).toFixed(2),   // @note: make filter cachable
    right : Number( opts.bbox.right ).toFixed(2), // precision max ~1.113km off
    bottom: Number( opts.bbox.bottom ).toFixed(2),
    left  : Number( opts.bbox.left ).toFixed(2),
    size: opts.size || 1,
    field: opts.field || 'center_point'
  };

  var query = centroid ? baseQueryWithCentroid( centroid, options ) : baseQuery( options );

  var filter = {
    'geo_bounding_box' : {
      '_cache': true // Speed up duplicate queries. Memory impact?
    }
  };

  filter.geo_bounding_box[ options.field ] = {
{'fraction_non_alphanumeric': 0.14968152866242038, 'fraction_numerical': 0.009554140127388535, 'mean_word_length': 3.3533487297921476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2049487', 'n_tokens_mistral': 642, 'n_tokens_neox': 620, 'n_words': 144}