Stephen Hess
901b6826ca
updated wording of test names and comments
8 years ago
Stephen Hess
ac0776e2be
match error handling to controller/search
8 years ago
Stephen Hess
6425cc6444
added request retries for ES request timeouts
8 years ago
Stephen Hess
d5ff417bf5
removed require's for mock backend/query
8 years ago
Stephen Hess
96f9d12ff5
rewrote tests to proxyquire service/search to reduce complexity
...
added a few more tests for coverage, removed unused things from unit/mock/backend
8 years ago
Stephen Hess
c7b83e96d5
added tests for case where error is a string, not an object
8 years ago
Stephen Hess
bf62a1844b
added tests for verifying request retry behavior
...
limited retry behavior to errors with status 408 (request timeout). this also reduces reliance on unit/mock/backend and unit/mock/query.
8 years ago
Stephen Hess
e83c12cd0e
added test for early bail when errors are present
...
simplified conditionals using lodash `.get`
8 years ago
Stephen Hess
8c249c26f4
initialize esclient in routes/v1, eliminating need for src/backend
8 years ago
Diana Shkolnikov
9ff383cc2b
change the query module interfaces back to simple functions
8 years ago
Diana Shkolnikov
d5ff072e9e
update tests
8 years ago
Stephen Hess
cc5c9f8468
disable calling GeodisambiguationQuery
8 years ago
Stephen Hess
2a9c25f8c4
added condition that `res.data` must be non-empty to return early
8 years ago
Stephen Hess
4952a0ed2b
added condition to exit early if there are already results in `res`
...
in order to accommodate falling back to the existing search strategy, the search controller must exit early if the `res.data` already exists.
8 years ago
Stephen Hess
f55aed2b1a
finished master rebase, checking in all-but-tests commit
...
rebase ended up being more complicated than was expected so i'm breaking this into a few commits
8 years ago
Julian Simioni
2557c68368
Use index name from config in controllers
9 years ago
Julian Simioni
fabf978ec1
Whitespace
9 years ago
Julian Simioni
3c1d758229
Fix timeout error handling
...
Timeout errors come back from the Elasticsearch module as Error objects,
so instead of pushing the entire object onto the errors array, we should
just push the message.
I'm not sure if there are other cases where errors are just strings,
errors that aren't objects with a message property are handled as
before.
9 years ago
Diana Shkolnikov
aff146aec3
Fix local naming convention and confidence score middlewares
9 years ago
Diana Shkolnikov
af8044ef29
Fix all unit tests
9 years ago
Julian Simioni
ef78b2e0fd
Filter source and layer by new fields
...
This is functionally the same code as before, except that it uses the
new source and layer mapping.
9 years ago
Julian Simioni
0e8f4253c0
Return multiple results in place when osm node and way share an id
...
It turns out the _type parameter to the Elasticsearch
[multiget](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html )
API does not allow an array of possible values. We were depending on its
ability to search multiple types to allow searching for OSM nodes and
ways.
But, since this doesn't work we essentially have to do it ourselves.
There is also the problem that OSM nodes and ways share an ID space. So
a gid such as `osm:venue:5` could in theory correspond to 2 records.
It seems like the only nice thing to do in that case is return both
results.
This PR "unrolls" such queries. For example, in the case of
`osm:venue:5`, the sanitisers will return the following array of objects
to be turned into multiget queries:
```
[{
id: 5,
types: ["osmway", "osmnode"]
}]
```
Before, this would turn into a multiget query with only one entry, like
this:
```
{
"docs": [
{
"_index": "pelias",
"_type": [
" osmnode",
"osmway"
],
"_id": 5
}
]
}
```
now it would look like this:
{
"docs": [
{
"_index": "pelias",
"_type": "osmnode",
"_id": 5
},
{
"_index": "pelias",
"_type": "osmnode",
"_id": 5
}
]
}
TLDR you might get back more records from /place than the number of ids
you specified, but at least you will definitely get back what you are
looking for.
9 years ago
Stephen Hess
cb7d22df91
switched ES lookup field from "type" -> "_type", fixes issue with /place lookup on Eiffel Tower gid
9 years ago
Julian Simioni
2505e92a62
Expect an array of types from _ids sanitiser
...
This doesn't have any effect by itself but allows for the 3-part gid
sanitiser to possibly return multiple types (i.e. in the case of
osm:venue:1000)
9 years ago
Julian Simioni
aabca1569c
Fix old reference to /doc endpoint
9 years ago
Diana Shkolnikov
2b22d611bd
Fix lost confidence score
9 years ago
Peter Johnson
348d2e70e2
more conformance
9 years ago
Diana Shkolnikov
2eccfc5c9a
Fix unit test
9 years ago
Diana Shkolnikov
f7044d2435
Add content for `attribution` static endpoint
...
Fixes #212
9 years ago
Diana Shkolnikov
db0e063d8c
Refactor controllers to be simple midddleware
...
Refactor search and doc controllers to allow for post-processing middleware
to handle geojson and response sending. Allows for a much more flexible routing scheme.
9 years ago
Julian Simioni
167547a6c1
Rename doc endpoint to place
9 years ago
Julian Simioni
2fce64f75a
Move files
9 years ago
Julian Simioni
4e74e9b681
Whitespace
9 years ago
Harish Krishna
e5f783567f
remove all things that involved suggester including query mixer
...
keeping the suggest sanitizer for suggest/nearby wherein lat/lon are required
10 years ago
Harish Krishna
b9c4c673f5
Revert "removing searchType overhead"
...
This reverts commit ee4aa1b97a
.
10 years ago
Harish Krishna
ee4aa1b97a
removing searchType overhead
10 years ago
Diana Shkolnikov
99ee2d95a3
Change to readFileSync and update test to use proxyquire
10 years ago
Diana Shkolnikov
4f1b75ce94
Fix test name
10 years ago
Diana Shkolnikov
1d45b20268
Load markdown file into memory and check if client requested html
10 years ago
Harish Krishna
a91cb23ea4
adding a new file DOCS.md (same as https://github.com/pelias/api/wiki/API-Endpoints ), modifying controller/index.js to return text/html instead of application/json by default. Using markdown module to convert MD to HTML. Fixing tests (removed test/jsonp.coffee)
10 years ago
Harish Krishna
0e9af3b9b8
adding controller tests to test details=true test case
10 years ago
Harish Krishna
c99c5f712a
adding a parameter called details (defaults to false for all endpoint except reverse) + fixing tests
10 years ago
Peter Johnson
ff757decb4
deprecate 'type' property, see PR notes
10 years ago
Harish Krishna
ff9e9973fc
switching searchType from the default 'query_then_fetch' to 'dfs_query_then_fetch' because we have multiple shards in prod http://www.elasticsearch.org/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch/
10 years ago
Harish Krishna
bcf823c519
cleanup + tests
10 years ago
Harish Krishna
fc7f6cb768
removing suggest_nearby, replacing suggest with suggest_multiple, commenting out a couple of tests for right now.
10 years ago
Harish Krishna
69a13e9105
fixing all the js lint related issues (lintified)
10 years ago
Harish Krishna
407c32e782
suggest_near_me to /suggest/nearby and suggest_near_me.js to suggest_nearby.js
10 years ago
Harish Krishna
886aa498f5
bringing back vanilla suggest (suggestions based on lat/lon/zoom only) - calling it suggest_near_me and adding a new endpoint (plus tests)
10 years ago
Harish Krishna
a53a6fd6d8
no query needed
10 years ago