Sarah Hoffmann
927d2cc824
do not split names from typed phrases
...
When phrases are typed, they should only contain exactly one term.
2023-07-17 20:09:08 +02:00
Sarah Hoffmann
7f9cb4e68d
split up get_assignment functon in more readable parts
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
d48ea4f22c
disallow address searches that start with a postcode
...
These are postcode searches and nothing else.
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
412bd2ec20
block search queries with too many tokens
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
1c189060c2
simplify yield_lookups() function
...
Move creation of field lookups in separate functions to make the code
more readable.
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
4a00a3c0f5
penalize name token splitting when phrases are used
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
8366e4ca83
penalize search with frequent partials
...
Avoid search against frequent partials if we have already looked for
the full name equivalents.
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
283db76e45
avoid splitting of first token when a housenumber is present
...
This only covers the case of <poi name> <street name> <housenumber>
which is exceedingly rare.
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
8a36ed4f6f
increase threshold for full name searches
...
They still should be preferrred over expensive partial name searches.
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
d0f45155c8
fix search for housenumber names
...
The search still included a lookup of housenumbers in children which is
wrong.
2023-07-17 16:27:25 +02:00
Sarah Hoffmann
7932b1849b
selected lambdas for search
2023-07-14 15:43:29 +02:00
Sarah Hoffmann
886374d779
add lambdas for layer filters
2023-07-14 15:27:20 +02:00
Sarah Hoffmann
d42e2e391f
avoid forwarding variables via SQL
2023-07-14 15:27:16 +02:00
Sarah Hoffmann
f264eaeda2
make SQL statements in reverse lambda functions
...
Further improves internal caching of statements by SQLAlchemy.
2023-07-14 14:39:14 +02:00
Sarah Hoffmann
d743cf308e
avoid index-use on rank parameters for reverse lookups
2023-07-09 22:49:31 +02:00
Sarah Hoffmann
f4cdcb995c
force a fixed pool size and make it configurable
2023-07-09 00:31:53 +02:00
Sarah Hoffmann
75139961a3
use constant expressions to select partial indexes in reverse
...
When expressions are generated with SQLAlchemy, any constants are
replaced with bind parameters. The bind parameters become parameters of
prepared statements. The result is that the query planner tends to
oversee that the partial indexes can be used.
2023-07-09 00:31:53 +02:00
Sarah Hoffmann
3e2dd59a94
remove disabling of prepared statements
...
Fixes for query planning with prepared statements to follow in
subsequent commits.
2023-07-08 15:59:15 +02:00
Sarah Hoffmann
e67355ab0e
make get_addressdata calls cachable
...
VALUEs() is not a cachable construct in SQLAlchemy, so use arrays
instead. Also add a special case for single results, the usual result
for reverse queries.
2023-07-06 12:16:57 +02:00
Sarah Hoffmann
9cb9b670d1
add support for postcompile literals in debug output
2023-07-06 12:16:57 +02:00
Sarah Hoffmann
cc45930ef9
avoid lookup via partials on frequent words
...
Drops expensive searches via partials on terms like 'rue de'.
See #2979 .
2023-07-06 12:16:57 +02:00
Sarah Hoffmann
3266daa8fd
add a small penalty to lookups in address vectors
2023-07-04 16:54:42 +02:00
Sarah Hoffmann
17a65d82bb
make types compatible with older Python versions
2023-07-02 23:06:42 +02:00
Sarah Hoffmann
49e0d83d5d
fix linting issues
2023-07-01 20:18:59 +02:00
Sarah Hoffmann
673c3c7a55
replace regexp_match with generic op() functions
...
Works around a bug in SQLAlchemy where regexp_match creates an
unstable cache key.
2023-07-01 18:15:22 +02:00
Sarah Hoffmann
5135041405
replace CASE construct with plpgsql function
2023-07-01 18:15:22 +02:00
Sarah Hoffmann
42631b85c7
band-aid for SQLAlchemy 1.4
2023-07-01 18:03:07 +02:00
Sarah Hoffmann
9f6f12cfeb
move search to bind parameters
2023-07-01 18:03:07 +02:00
Sarah Hoffmann
6c4c9ec1f2
switch reverse() to new Geometry datatype
...
Also switches to using bind parameters for recurring parameters.
2023-07-01 18:03:07 +02:00
Sarah Hoffmann
4bb4db0668
introduce slim Geometry database type
2023-07-01 18:03:07 +02:00
Sarah Hoffmann
0d338fa4c0
bdd: fix faking HTTP headers for python web frameworks
2023-06-22 14:00:33 +02:00
Sarah Hoffmann
3a21999a17
move text normalization into extra function
2023-06-22 10:48:05 +02:00
Sarah Hoffmann
0deb9262c9
use in operator for enum tests
...
Fixes a complaint by mypy.
2023-06-21 15:30:40 +02:00
Sarah Hoffmann
9bc5be837b
remove useless check
...
Found by new mypy version.
2023-06-21 11:56:39 +02:00
Sarah Hoffmann
4ad8818809
avoid fallback country lookup when places are excluded
2023-06-20 12:22:08 +02:00
Sarah Hoffmann
2f4342810d
allow empty parts in excluded_place_id
...
This worked before.
2023-06-20 11:56:43 +02:00
Sarah Hoffmann
36df56b093
fix header name for browser languages
2023-06-20 11:56:43 +02:00
Sarah Hoffmann
d0a1e8e311
tweak postcode search
...
Give a preference to left-right reading, i.e <postcode>,<address>
prefers a postcode search while <address>,<postcode> rather does
an address search.
Also exclude non-addressables, countries and state from results when a
postcode is contained in the query.
2023-06-20 11:56:43 +02:00
Sarah Hoffmann
1b50381852
use string representation when dumping variables
2023-06-20 10:15:51 +02:00
Sarah Hoffmann
3443d2c129
fix debug output for searches
...
Fields have been renamed.
2023-06-20 10:12:19 +02:00
Sarah Hoffmann
317cc5c544
make code backwards-compatible with older Python versions
2023-05-26 23:33:35 +02:00
Sarah Hoffmann
43c27dffd2
fix new linting warning
2023-05-26 16:31:43 +02:00
Sarah Hoffmann
8f299838f7
fix various failing BDD tests
2023-05-26 15:08:48 +02:00
Sarah Hoffmann
146a0b29c0
add support for search by houenumber
2023-05-26 14:10:57 +02:00
Sarah Hoffmann
964bc7fbe0
ignore name rankings without variants
2023-05-26 13:53:34 +02:00
Sarah Hoffmann
0843fefad3
fix geocodejson address assignment
...
The categories should be assigned the address part with the
highest address rank not lowest.
2023-05-26 11:43:11 +02:00
Sarah Hoffmann
371a780ef4
add server fronting for search endpoint
...
This also implements some of the quirks of free-text search of the
V1 API, in particular, search for categories and coordinates.
2023-05-26 11:40:45 +02:00
Sarah Hoffmann
c7db69a30c
add timestamps to HTML debug output
2023-05-26 09:05:44 +02:00
Sarah Hoffmann
b48cda7173
mingle names from linked places into results
2023-05-24 23:17:15 +02:00
Sarah Hoffmann
0608cf1476
switch CLI search command to python implementation
2023-05-24 22:54:54 +02:00