Sarah Hoffmann
e0ca2ce6ec
interpret stand-alone special terms always as near term
...
Fixes #3298 .
2024-01-16 17:19:21 +01:00
Sarah Hoffmann
28f7e51279
add country code to words to be rematched
2024-01-08 12:23:23 +01:00
Sarah Hoffmann
b2afe3ce3e
when a country is in the results, restrict further searches to places
...
A country search result usually comes with a very high importance.
As a result only other very well known places will show up together
with country results and that means only places with lower address
ranks. Name searches for country names tend to yield a lot of POI
results because the country name is part of the name
(think "embassy of Sweden"). By excluding POIs from further searches,
the search is sped up quite a bit.
2024-01-07 17:29:12 +01:00
Sarah Hoffmann
7337898b84
dump params in log view
2024-01-07 15:37:53 +01:00
Sarah Hoffmann
4305160c91
prioritize country searches when penaly is equal
2024-01-07 15:28:37 +01:00
Sarah Hoffmann
d3a575319f
Merge pull request #3289 from lonvia/viewbox-and-housenumbers
...
Do not restrict by viewbox when housenumber or postcode is available
2024-01-07 15:23:14 +01:00
Sarah Hoffmann
2592bf1954
Merge pull request #3290 from lonvia/near-vs-quaifier-words
...
Do not run near queries on qualifier words
2024-01-07 15:23:00 +01:00
Sarah Hoffmann
474d4230b8
fix timezone handling for timestamps from the database
...
SQLite is not timezone-aware, so make sure to convert to UTC
before inserting any data.
2024-01-07 11:37:40 +01:00
Sarah Hoffmann
10a5424a71
do not run near queries on qualifier words
...
There is too much potential for confusion (e.g. 'Rio Grande' read
as 'river near Grande') fir too little gain. Use near phrases
instead.
2024-01-07 11:33:11 +01:00
Sarah Hoffmann
7eb04f67e2
do not restrict by viewbox when housenumber or postcode is available
...
Fixes #3274 .
2024-01-07 11:29:26 +01:00
Sarah Hoffmann
8e90fa3395
avoid closure variables in lambda statements
...
There is a bug in SQLAlchemy that assigns the wrong value to bind
parameters from closure variables when reusing lambda statements
that are later extended with other non-lambda expressions.
Thus either avoid lambda statements with closure variables or extending
them with non-lambda expressions.
2024-01-05 17:49:28 +01:00
Sarah Hoffmann
02af0a2c87
use correct SQLAlchemy pool for asynchronous connections
...
See https://github.com/sqlalchemy/sqlalchemy/issues/8771
2024-01-02 16:15:44 +01:00
Sarah Hoffmann
fa4e5513d1
API: avoid engine disposal on startup
2024-01-02 16:10:30 +01:00
Sarah Hoffmann
93afe5a7c3
update typing for latest changes in SQLAlchemy
2023-12-29 20:55:33 +01:00
Sarah Hoffmann
89094cf92e
error out when a SQLite database does not exist
...
Requires to mark the databse r/w when it is newly created in the
convert function.
2023-12-07 10:24:53 +01:00
Sarah Hoffmann
6d39563b87
enable all API tests for sqlite and port missing features
2023-12-07 09:32:02 +01:00
Sarah Hoffmann
df6eddebcd
void unnecessary aliases
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
b6c8c0e72b
factor out SQL for filtering by location
...
Also improves on the decision if an indexed is used or not.
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
b06f5fddcb
simplify handling of SQL lookup code for search_name
...
Use function classes which can be instantiated directly.
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
615b166c68
clean up ST_DWithin and intersects() functions
...
A non-index version of ST_DWithin is not necessary. ST_Distance
can be used for that purpose. Index use for intersects can be
covered with a simple parameter.
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
c41f2fed21
simplify weigh_search() function
...
Use JSON arrays which can have mixed types and therefore have
a more logical structure than separate arrays. Avoid JSON dicts
because of their verboseness.
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
05e47fbb28
fix parameter formatting in sqlite debug output
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
1b7c8240ba
enable connection pools for sqlite
...
Connecting is reasonably expensive because the spatialite extension
needs to be loaded. Disable pooling for tests because there is some
memory leak when quickly opening and closing QueuePools with sqlite
connections.
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
c4fd3ab97f
hide type differences between Postgres and Sqlite in custom types
...
Also define a custom set of operators in preparation of differences
in implementation.
2023-12-07 09:31:00 +01:00
Sarah Hoffmann
8a2c6067a2
skip lookup with full names when there are none
2023-12-01 12:11:58 +01:00
Sarah Hoffmann
3c7a28dab0
further restrict stop search criterion
2023-11-29 11:28:54 +01:00
Sarah Hoffmann
0c72a434e0
use restrict for housenumber lookups with few numbers
2023-11-29 11:28:54 +01:00
Sarah Hoffmann
32e7b59b1f
NearSearch needs to inherit penalty from inner search
2023-11-29 11:28:52 +01:00
Sarah Hoffmann
b2319e52ff
correctly exclude streets with housenumber searches
...
Street result are not subject to the full filtering in the SQL
query, so recheck.
2023-11-28 17:53:37 +01:00
Sarah Hoffmann
25279d009a
add tests for interaction of category parameter with category terms
2023-11-28 16:56:08 +01:00
Sarah Hoffmann
3f72ca4bca
rename use of category as POI search to near_item
...
Use the term category only as a short-cut for "tuple of key and value".
2023-11-28 16:27:05 +01:00
Sarah Hoffmann
70dc4957dc
the category parameter in search should result in a qualifier
2023-11-28 12:01:49 +01:00
Sarah Hoffmann
a7f5c6c8f5
drop category tokens when they make up a full phrase
2023-11-26 20:58:50 +01:00
Sarah Hoffmann
a8b023e57e
restrict base results in near search by rank
...
This avoids in particular that roads or POIs are used as base
for the near search when a place result is present.
2023-11-26 17:41:29 +01:00
Sarah Hoffmann
47ca56f21b
deduplicate categories/qualifiers
2023-11-26 17:11:15 +01:00
Sarah Hoffmann
580a7b032f
order near searches by distance instead of importance
2023-11-26 16:48:04 +01:00
Sarah Hoffmann
8fcc2bb7f5
avoid duplicate lines during category search
2023-11-26 14:53:20 +01:00
Sarah Hoffmann
d6fe58f84e
fix polygon selection for classtable lookups
...
Polygons should be used preferably with higher address ranks
where the areas are smaller.
2023-11-25 21:01:27 +01:00
Sarah Hoffmann
4e4d29f653
increase penalty for one-letter words
2023-11-23 10:51:58 +01:00
Sarah Hoffmann
195c13ee8a
more preference for name-only queries in search
2023-11-22 23:57:23 +01:00
Sarah Hoffmann
ac5ef64701
avoid index use when filtering by layer
2023-11-22 20:54:04 +01:00
Sarah Hoffmann
e7dc24c026
add timestamps to text logging
2023-11-22 17:38:32 +01:00
Sarah Hoffmann
155f26060d
avoid index on rank_address in near search
2023-11-22 17:33:17 +01:00
Sarah Hoffmann
a87fe8d8bf
exclude country-level searches with non-address layers
2023-11-22 17:01:41 +01:00
Sarah Hoffmann
2bf8e62580
fix assertion on address list, it may be empty
...
Fixes #3237 .
2023-10-31 21:10:54 +01:00
Sarah Hoffmann
899a04ad26
make code work with Spatialite 4.3
...
Transfer is_address_point into SQLAlchemy function, so that
json.has_key() can use the older json_extract() function.
And work around broken Distance function.
2023-10-23 17:19:12 +02:00
Sarah Hoffmann
d8dca2a3a9
enable BDD tests for sqlite databases
...
The database must currently be created by hand and the name handed
in via -DAPI_TEST_DB='sqlite:...'.
2023-10-23 17:19:12 +02:00
Sarah Hoffmann
8216899a9a
trim all coordinate output to 7 digits
2023-10-23 17:19:12 +02:00
Sarah Hoffmann
0417946153
make reverse API work with sqlite
2023-10-23 17:19:12 +02:00
Sarah Hoffmann
06bbd501fd
make status API work with sqlite incl. unit tests
2023-10-23 17:19:12 +02:00