GithubHelp home page GithubHelp logo

geonamesserver's People

Contributors

csaoh avatar ebreton avatar nlegoff avatar pborreli avatar romainneutron avatar tk120404 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geonamesserver's Issues

Queries with hyphens fail

Given a city with a composed name "corbeil-essone" is indexed
Looking for "corbeil-essone" returns 0 result

Error with an example request given in the homepage

Hi,

Just tested the request "/ip?ip=4.23.171.0&callback=myFunction" given in the homepage and get this error on screen :

myfunction({
  "error": "internal server error"
});

And this in logs :

elastic search error, got error  null  status code  200  and response  { domain: null,
  _events:
   { close: [ [Function], [Function] ],
     data: [Function],
     end: [ [Function], [Function: responseOnEnd] ] },
  _maxListeners: 10,
  socket:
   { domain: null,
     _events:
      { free: [Function],
        close: [Object],
        agentRemove: [Function],
        drain: [Function: ondrain],
        error: [Object] },
     _maxListeners: 10,
     _handle:
      { writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread] },
     _pendingWriteReqs: 0,
     _flags: 0,
     _connectQueueSize: 0,
     destroyed: false,
     errorEmitted: false,
     bytesRead: 5955,
     _bytesDispatched: 1544,
     allowHalfOpen: undefined,
     _connecting: false,
     writable: true,
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncomingClient] },
     _httpMessage:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _hasBody: true,
        _trailer: '',
        finished: true,
        agent: [Object],
        socketPath: undefined,
        method: 'GET',
        path: '/geonames_prod/cities/_search',
        _headers: [Object],
        _headerNames: [Object],
        _header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
        _headerSent: true,
        socket: [Circular],
        connection: [Circular],
        parser: [Object],
        res: [Circular] },
     ondata: [Function: socketOnData],
     onend: [Function: socketOnEnd],
     _connectQueue: null,
     readable: true },
  connection:
   { domain: null,
     _events:
      { free: [Function],
        close: [Object],
        agentRemove: [Function],
        drain: [Function: ondrain],
        error: [Object] },
     _maxListeners: 10,
     _handle:
      { writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread] },
     _pendingWriteReqs: 0,
     _flags: 0,
     _connectQueueSize: 0,
     destroyed: false,
     errorEmitted: false,
     bytesRead: 5955,
     _bytesDispatched: 1544,
     allowHalfOpen: undefined,
     _connecting: false,
     writable: true,
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncomingClient] },
     _httpMessage:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _hasBody: true,
        _trailer: '',
        finished: true,
        agent: [Object],
        socketPath: undefined,
        method: 'GET',
        path: '/geonames_prod/cities/_search',
        _headers: [Object],
        _headerNames: [Object],
        _header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
        _headerSent: true,
        socket: [Circular],
        connection: [Circular],
        parser: [Object],
        res: [Circular] },
     ondata: [Function: socketOnData],
     onend: [Function: socketOnEnd],
     _connectQueue: null,
     readable: true },
  httpVersion: '1.1',
  complete: true,
  headers:
   { 'content-type': 'application/json; charset=UTF-8',
     'content-length': '5848' },
  trailers: {},
  readable: false,
  _paused: false,
  _pendings: [],
  _endEmitted: false,
  url: '',
  method: null,
  statusCode: 500,
  client:
   { domain: null,
     _events:
      { free: [Function],
        close: [Object],
        agentRemove: [Function],
        drain: [Function: ondrain],
        error: [Object] },
     _maxListeners: 10,
     _handle:
      { writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread] },
     _pendingWriteReqs: 0,
     _flags: 0,
     _connectQueueSize: 0,
     destroyed: false,
     errorEmitted: false,
     bytesRead: 5955,
     _bytesDispatched: 1544,
     allowHalfOpen: undefined,
     _connecting: false,
     writable: true,
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncomingClient] },
     _httpMessage:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _hasBody: true,
        _trailer: '',
        finished: true,
        agent: [Object],
        socketPath: undefined,
        method: 'GET',
        path: '/geonames_prod/cities/_search',
        _headers: [Object],
        _headerNames: [Object],
        _header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
        _headerSent: true,
        socket: [Circular],
        connection: [Circular],
        parser: [Object],
        res: [Circular] },
     ondata: [Function: socketOnData],
     onend: [Function: socketOnEnd],
     _connectQueue: null,
     readable: true },
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  upgrade: false,
  request:
   { domain: null,
     _events:
      { error: [Function],
        complete: [Function],
        pipe: [Object],
        end: [Object],
        data: [Function] },
     _maxListeners: 10,
     readable: true,
     writable: true,
     uri:
      { protocol: 'http:',
        slashes: true,
        host: '10.143.115.25:9200',
        port: '9200',
        hostname: '10.143.115.25',
        href: 'http://10.143.115.25:9200/geonames_prod/cities/_search',
        pathname: '/geonames_prod/cities/_search',
        path: '/geonames_prod/cities/_search' },
     body: <Buffer 7b 22 73 69 7a 65 22 3a 31 2c 22 73 6f 72 74 22 3a 5b 22 5f 73 63 6f 72 65 22 5d 2c 22 66 69 65 6c 64 73 22 3a 5b 22 67 65 6f 6e 61 6d 65 69 64 22 2c 22 ...>,
     callback: [Function],
     pool: {},
     dests: [],
     __isRequestRequest: true,
     _callback: [Function],
     _redirectsFollowed: 0,
     maxRedirects: 10,
     followRedirect: true,
     followAllRedirects: false,
     redirects: [],
     headers: { 'content-length': 1426 },
     setHost: true,
     originalCookieHeader: undefined,
     _jar: undefined,
     port: '9200',
     host: '10.143.115.25',
     clientErrorHandler: [Function],
     _parserErrorHandler: [Function],
     path: '/geonames_prod/cities/_search',
     httpModule:
      { parsers: [Object],
        STATUS_CODES: [Object],
        IncomingMessage: [Object],
        OutgoingMessage: [Object],
        ServerResponse: [Object],
        Agent: [Object],
        globalAgent: [Object],
        ClientRequest: [Object],
        request: [Function],
        get: [Function],
        Server: [Object],
        createServer: [Function],
        _connectionListener: [Function: connectionListener],
        Client: [Function: deprecated],
        createClient: [Function: deprecated] },
     agentClass: { [Function: Agent] super_: [Object], defaultMaxSockets: 5 },
     agent:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        options: {},
        requests: {},
        sockets: [Object],
        maxSockets: 5,
        createConnection: [Function] },
     _started: true,
     method: 'GET',
     href: 'http://10.143.115.25:9200/geonames_prod/cities/_search',
     req:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _hasBody: true,
        _trailer: '',
        finished: true,
        agent: [Object],
        socketPath: undefined,
        method: 'GET',
        path: '/geonames_prod/cities/_search',
        _headers: [Object],
        _headerNames: [Object],
        _header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        parser: [Object],
        res: [Circular] },
     ntick: true,
     response: [Circular],
     _destdata: true,
     _ended: true },
  toJSON: [Function: toJSON],
  req:
   { domain: null,
     _events: { error: [Function], drain: [Function] },
     _maxListeners: 10,
     output: [],
     outputEncodings: [],
     writable: true,
     _last: false,
     chunkedEncoding: false,
     shouldKeepAlive: true,
     useChunkedEncodingByDefault: false,
     sendDate: false,
     _hasBody: true,
     _trailer: '',
     finished: true,
     agent:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        options: {},
        requests: {},
        sockets: [Object],
        maxSockets: 5,
        createConnection: [Function] },
     socketPath: undefined,
     method: 'GET',
     path: '/geonames_prod/cities/_search',
     _headers: { host: '10.143.115.25:9200', 'content-length': 1426 },
     _headerNames: { host: 'host', 'content-length': 'content-length' },
     _header: 'GET /geonames_prod/cities/_search HTTP/1.1\r\nhost: 10.143.115.25:9200\r\ncontent-length: 1426\r\nConnection: keep-alive\r\n\r\n',
     _headerSent: true,
     socket:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        _handle: [Object],
        _pendingWriteReqs: 0,
        _flags: 0,
        _connectQueueSize: 0,
        destroyed: false,
        errorEmitted: false,
        bytesRead: 5955,
        _bytesDispatched: 1544,
        allowHalfOpen: undefined,
        _connecting: false,
        writable: true,
        parser: [Object],
        _httpMessage: [Circular],
        ondata: [Function: socketOnData],
        onend: [Function: socketOnEnd],
        _connectQueue: null,
        readable: true },
     connection:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        _handle: [Object],
        _pendingWriteReqs: 0,
        _flags: 0,
        _connectQueueSize: 0,
        destroyed: false,
        errorEmitted: false,
        bytesRead: 5955,
        _bytesDispatched: 1544,
        allowHalfOpen: undefined,
        _connecting: false,
        writable: true,
        parser: [Object],
        _httpMessage: [Circular],
        ondata: [Function: socketOnData],
        onend: [Function: socketOnEnd],
        _connectQueue: null,
        readable: true },
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Object],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncomingClient] },
     res: [Circular] },
  body: '{"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[KGbdV3rHS3aiVertaRM-gA][geonames_prod][2]: SearchParseException[[geonames_prod][2]: from[-1],size[1]: Parse Failure [Failed to parse source [{\\"size\\":1,\\"sort\\":[\\"_score\\"],\\"fields\\":[\\"geonameid\\",\\"name\\",\\"asciiname\\",\\"alternatenames\\",\\"names\\",\\"countryCode\\",\\"featureClass\\",\\"featureCode\\",\\"cc2\\",\\"admin1Code\\",\\"admin2Code\\",\\"admin3Code\\",\\"admin4Code\\",\\"latitude\\",\\"longitude\\",\\"population\\",\\"DEM\\",\\"timezone\\",\\"modificationDate\\",\\"pin\\"],\\"query\\":{\\"bool\\":{\\"must\\":[{\\"terms\\":{\\"featureCode\\":[\\"ppl\\",\\"ppla\\",\\"ppla2\\",\\"ppla3\\",\\"ppla4\\",\\"pplc\\",\\"pplf\\",\\"pplg\\",\\"ppll\\",\\"pplq\\",\\"pplr\\",\\"ppls\\",\\"pplw\\",\\"pplx\\",\\"stlmt\\"],\\"minimum_match\\":1}},{\\"terms\\":{\\"countryCode\\":[\\"us\\"],\\"minimum_match\\":1}}],\\"boost\\":1,\\"should\\":[{\\"custom_filters_score\\":{\\"query\\":{\\"query_string\\":{\\"fields\\":[\\"name^3\\",\\"alternatenames\\"]}},\\"filters\\":[{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"1000\\"}}},\\"boost\\":2},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"10000\\"}}},\\"boost\\":5},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"100000\\"}}},\\"boost\\":3},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"10km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":15},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"200km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":12},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"1000km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":5},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name.untouched\\"}}},\\"boost\\":2},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name\\"}}},\\"boost\\":5}],\\"score_mode\\":\\"multiply\\"}},{\\"prefix\\":{}},{\\"prefix\\":{}}],\\"minimum_number_should_match\\":1}},\\"highlight\\":{\\"fields\\":{\\"name\\":{}}},\\"track_scores\\":true}]]]; nested: QueryParsingException[[geonames_prod] query_string must be provided with a [query]]; }{[KGbdV3rHS3aiVertaRM-gA][geonames_prod][4]: SearchParseException[[geonames_prod][4]: from[-1],size[1]: Parse Failure [Failed to parse source [{\\"size\\":1,\\"sort\\":[\\"_score\\"],\\"fields\\":[\\"geonameid\\",\\"name\\",\\"asciiname\\",\\"alternatenames\\",\\"names\\",\\"countryCode\\",\\"featureClass\\",\\"featureCode\\",\\"cc2\\",\\"admin1Code\\",\\"admin2Code\\",\\"admin3Code\\",\\"admin4Code\\",\\"latitude\\",\\"longitude\\",\\"population\\",\\"DEM\\",\\"timezone\\",\\"modificationDate\\",\\"pin\\"],\\"query\\":{\\"bool\\":{\\"must\\":[{\\"terms\\":{\\"featureCode\\":[\\"ppl\\",\\"ppla\\",\\"ppla2\\",\\"ppla3\\",\\"ppla4\\",\\"pplc\\",\\"pplf\\",\\"pplg\\",\\"ppll\\",\\"pplq\\",\\"pplr\\",\\"ppls\\",\\"pplw\\",\\"pplx\\",\\"stlmt\\"],\\"minimum_match\\":1}},{\\"terms\\":{\\"countryCode\\":[\\"us\\"],\\"minimum_match\\":1}}],\\"boost\\":1,\\"should\\":[{\\"custom_filters_score\\":{\\"query\\":{\\"query_string\\":{\\"fields\\":[\\"name^3\\",\\"alternatenames\\"]}},\\"filters\\":[{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"1000\\"}}},\\"boost\\":2},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"10000\\"}}},\\"boost\\":5},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"100000\\"}}},\\"boost\\":3},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"10km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":15},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"200km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":12},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"1000km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":5},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name.untouched\\"}}},\\"boost\\":2},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name\\"}}},\\"boost\\":5}],\\"score_mode\\":\\"multiply\\"}},{\\"prefix\\":{}},{\\"prefix\\":{}}],\\"minimum_number_should_match\\":1}},\\"highlight\\":{\\"fields\\":{\\"name\\":{}}},\\"track_scores\\":true}]]]; nested: QueryParsingException[[geonames_prod] query_string must be provided with a [query]]; }{[KGbdV3rHS3aiVertaRM-gA][geonames_prod][0]: SearchParseException[[geonames_prod][0]: from[-1],size[1]: Parse Failure [Failed to parse source [{\\"size\\":1,\\"sort\\":[\\"_score\\"],\\"fields\\":[\\"geonameid\\",\\"name\\",\\"asciiname\\",\\"alternatenames\\",\\"names\\",\\"countryCode\\",\\"featureClass\\",\\"featureCode\\",\\"cc2\\",\\"admin1Code\\",\\"admin2Code\\",\\"admin3Code\\",\\"admin4Code\\",\\"latitude\\",\\"longitude\\",\\"population\\",\\"DEM\\",\\"timezone\\",\\"modificationDate\\",\\"pin\\"],\\"query\\":{\\"bool\\":{\\"must\\":[{\\"terms\\":{\\"featureCode\\":[\\"ppl\\",\\"ppla\\",\\"ppla2\\",\\"ppla3\\",\\"ppla4\\",\\"pplc\\",\\"pplf\\",\\"pplg\\",\\"ppll\\",\\"pplq\\",\\"pplr\\",\\"ppls\\",\\"pplw\\",\\"pplx\\",\\"stlmt\\"],\\"minimum_match\\":1}},{\\"terms\\":{\\"countryCode\\":[\\"us\\"],\\"minimum_match\\":1}}],\\"boost\\":1,\\"should\\":[{\\"custom_filters_score\\":{\\"query\\":{\\"query_string\\":{\\"fields\\":[\\"name^3\\",\\"alternatenames\\"]}},\\"filters\\":[{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"1000\\"}}},\\"boost\\":2},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"10000\\"}}},\\"boost\\":5},{\\"filter\\":{\\"numeric_range\\":{\\"population\\":{\\"from\\":\\"100000\\"}}},\\"boost\\":3},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"10km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":15},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"200km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":12},{\\"filter\\":{\\"geo_distance\\":{\\"distance\\":\\"1000km\\",\\"pin.location\\":{\\"lat\\":38,\\"lon\\":-97}}},\\"boost\\":5},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name.untouched\\"}}},\\"boost\\":2},{\\"filter\\":{\\"query\\":{\\"query_string\\":{\\"default_field\\":\\"name\\"}}},\\"boost\\":5}],\\"score_mode\\":\\"multiply\\"}},{\\"prefix\\":{}},{\\"prefix\\":{}}],\\"minimum_number_should_match\\":1}},\\"highlight\\":{\\"fields\\":{\\"name\\":{}}},\\"track_scores\\":true}]]]; nested: QueryParsingException[[geonames_prod] query_string must be provided with a [query]]; }]","status":500}' }

js-error in chrome

on requesting / i get this error:

Refused to execute script from 'https://raw.github.com/evilstreak/markdown-js/master/lib/markdown.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. localhost/:1
Uncaught ReferenceError: markdown is not defined 

import.sh crashes after importing data in mongo

Hi,

I have this message while running import.sh :

PHP Warning: require_once(/home/sites_web/GeonamesServer/import/vendor/autoload.php): failed to open stream: Aucun fichier ou dossier de ce type in /home/sites_web/GeonamesServer/import/index.php on line 5
PHP Fatal error: require_once(): Failed opening required '/home/sites_web/GeonamesServer/import/vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/sites_web/GeonamesServer/import/index.php on line 5

Is there something missing on the documentation or a real problem in the script ?

Regards

Add a mongo and elastic search configuration file

Since install & test command are running using Makefile we can not precise mongo or elastic connection credentials.

We should create a configuration file for those credentials and parse it in install.sh and test.sh script

check pre requisite before downloading data

If mongo or elastic search are not present, the data is downloaded (long process) and it fails after that.

If all conditions could be verified before that, that would be awesome

Docker Build

It looks like this repository may have been abandoned. Because some of the requirements for tools etc are quite old I've created a docker build for this. The built contains all of the data in it, so all you need to do is simply run the container and its ready to go!

You can find the container on DockerHub here, https://hub.docker.com/r/jumplead/geonames-server/

I try and rebuild the container once a month to get the latest data 👍

closeness sort does not work as expected if no sortParam provided

When sorting by closeness, sort should be done against the client IP address if no sortParam is provided.

This is actually not the case, here are the result for paris, from paris, with and without sort params :

without :

parameters are :

array(
            'sort' => 'closeness',
            'name' => $place,
            'limit' => 1,
);

result is :

HTTP/1.1 200 OK
Server: nginx
Date: Mon, 17 Jun 2013 22:34:32 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 523
Connection: keep-alive
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With, origin, content-type, accept
Access-Control-Allow-Methods: OPTIONS, GET, POST
X-Geonames-sortby: population

{
  "geonames": {
    "totalResultsCount": "1",
    "geoname": [
      {
        "geonameid": "6837753",
        "title": "Paris",
        "country": "Indonesia",
        "match": {
          "title": "Paris",
          "country": "Indonesia"
        },
        "population": "0",
        "location": {
          "latitude": "-7.52",
          "longitude": "112.56"
        },
        "names": [
          "paris",
          "paris"
        ],
        "region": "East Java",
        "title_alt": "paris"
      }
    ]
  }
}

with :

parameters are :

array(
            'sort' => 'closeness',
            'name' => $place,
            'limit' => 1,
            'sortParams'=>array(
                'ip' => '5.49.69.114'
            )
)

result is

HTTP/1.1 200 OK
Server: nginx
Date: Mon, 17 Jun 2013 22:36:21 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 503
Connection: keep-alive
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With, origin, content-type, accept
Access-Control-Allow-Methods: OPTIONS, GET, POST
X-Geonames-sortby: closeness

{
  "geonames": {
    "totalResultsCount": "1",
    "geoname": [
      {
        "geonameid": "2988496",
        "title": "Parisot",
        "country": "France",
        "match": {
          "title": "Parisot",
          "country": "France"
        },
        "population": "0",
        "location": {
          "latitude": "44.83",
          "longitude": "0.9"
        },
        "names": [
          "parisot"
        ],
        "region": "Aquitaine",
        "title_alt": "parisot"
      }
    ]
  }
}

You can note that the accuracy is not good

Request: Admin Code Lookup

It would be nice if we could also return the Administration Area for city results too. These can be looked up by joining the various admin codes together and querying the data in admin2Codes and admin1CodesASCII.

It appears that admin1Codes is already in the database, but admin2Codes isn't. Its only a small amount of data so shouldn't really impact performance in any way.

I would have a go myself but unfortunately I know nothing about nodejs, I'm a PHP developer.

Adam

Incompatible with ElasticSearch > v0.90.4

ElasticSearch after v0.90.4 replaced "custom_filters_score" query with "function_score", subsequently making all the queries to the server to fail.

Latest output from node server after doing GET to /city:

nested: QueryParsingException[[geonames] No query registered for [custom_filters_score]]; }]","status":400}' }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.