Opened 7 years ago
Last modified 5 years ago
#15943 reopened defect
Misbehaviour or wrong description of search string 'key='
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | 18.02 |
Component: | Core | Version: | tested |
Keywords: | template_report search dialog | Cc: |
Description (last modified by )
In the search (or filter) window, the search string 'key=' is explained (in the tooltip) to "match if 'key' exists", however it does the opposite: it matches if 'key' is empty.
What steps will reproduce the problem?
- Ctrl + F
- Enter
type:way highway=* -surface=
What is the expected result?
Select highways without surface tag
What happens instead?
Highways *with* existing surface tag are highlighted.
Please provide any additional information below. Attach a screenshot if possible.
URL:http://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2018-01-28 23:08:56 +0100 (Sun, 28 Jan 2018) Build-Date:2018-01-28 22:25:44 Revision:13367 Relative:URL: ^/trunk Identification: JOSM/1.5 (13367 en_GB) Mac OS X 10.12.6 OS Build number: Mac OS X 10.12.6 (16G1212) Memory Usage: 384 MB / 910 MB (96 MB allocated, but free) Java version: 1.8.0_161-b12, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Screen: Display 69677504 1280x800 Maximum Screen Size: 1280x800 VM arguments: [-Djava.library.path=/Applications/JOSM.app/Contents/MacOS, -DLibraryDirectory=${HOME}/Library, -DDocumentsDirectory=${HOME}/Documents, -DApplicationSupportDirectory=${HOME}/Library/Application Support, -DCachesDirectory=${HOME}/Library/Caches, -DSandboxEnabled=false, -Dapple.laf.useScreenMenuBar=true, -Dcom.apple.macos.use-file-dialog-packages=true, -Dcom.apple.macos.useScreenMenuBar=true, -Dcom.apple.mrj.application.apple.menu.about.name=JOSM, -Dcom.apple.smallTabs=true] Dataset consistency test: No problems found Plugins: + reverter (34036) + tageditor (33806) + undelete (33980) + utilsplugin2 (33991) Map paint styles: - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Sidewalks&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/LayerChecker&zip=1 Last errors/warnings: - W: No configuration settings found. Using hardcoded default values for all pools. - E: org.openstreetmap.josm.io.OsmApiException: ResponseCode=400, Error Header=<You requested too many nodes (limit is 50000). Either request a smaller area, or use planet.osm> - E: Bad Request - <html>The OSM server 'api.openstreetmap.org' reported a bad request.<br><br>The area you tried to download is too big or your request was too large.<br>Either request a smaller area or use an export file provided by the OSM community.</html>
Attachments (1)
Change History (23)
comment:1 by , 7 years ago
Milestone: | → 18.02 |
---|
comment:2 by , 7 years ago
Description: | modified (diff) |
---|
comment:3 by , 7 years ago
I'm not sure if it is even possible in the osm database to have emtpy values.
Yes, it is:
https://www.openstreetmap.org/way/292168826
(Added with level0.)
comment:6 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
It seems that there's still something wrong with the filter:
type:way highway sidewalk=
filters highway ways with any sidewalk value, not just those with an empty sidewalk valuetype:way highway -sidewalk
also filtersfootway=sidewalk
, but infootway=sidewalk
,sidewalk
is the value, not the key
JOSM version used: 13500
comment:7 by , 5 years ago
Replying to selfishseahorse@…:
You filters are not correct as highway
or -sidewalk
does not say anything about key or value, e.g. both are searched.
type:way highway sidewalk=
filters highway ways with any sidewalk value, not just those with an empty sidewalk value
type:way highway=* sidewalk=
type:way highway -sidewalk
also filtersfootway=sidewalk
, but infootway=sidewalk
,sidewalk
is the value, not the key
type:way highway=* -sidewalk=*
Though, you are right that something does not work (have a look at the example file):
- Search 1. finds
highway=footway
withfootway=sidewalk
type:way highway=* -sidewalk=
does not findhighway=footway
withfootway=sidewalk
type:way highway= sidewalk=
is marked as invalid expression and not accepted
comment:8 by , 5 years ago
Yes, something is wrong. A search string sidewalk
is searched in key and value. Also side
or dewa
will match.
Don't know if this is intended.
comment:9 by , 5 years ago
I am not able to search/filter ways which are member of a relation:
type:way parent (type:relation)
finds nothing
Edit: Wrong search.
comment:10 by , 5 years ago
GerdP in 19070#comment:8:
I didn't try to understand the details of the code in SearchCompiler, else I would already have tried to fix #15943.
Looking at your changes in r16260 we probably just have to remove one line?
src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java
291 291 .addKeyword("-<i>key</i>:<i>valuefragment</i>", null, tr("''valuefragment'' nowhere in ''key''")), 292 292 GBC.eol()); 293 293 hintPanel.add(new SearchKeywordRow(hcbSearchString) 294 .addKeyword("<i>key</i>", null, tr("matches if ''key'' exists"))295 294 .addKeyword("<i>key</i>=<i>value</i>", null, tr("''key'' with exactly ''value''")) 296 295 .addKeyword("<i>key</i>~<i>regexp</i>", null, tr("value of ''key'' matching the regular expression ''regexp''")) 297 296 .addKeyword("<i>key</i>=*", null, tr("''key'' with any value"))
comment:12 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:13 by , 5 years ago
Keywords: | search dialog added |
---|
comment:14 by , 5 years ago
Not fixed at all!
Still all searches from comment:7 are not working (same results) and type:way (parent type:relation)
still finds nothing (comment:9).
Only comment:8 is working now.
The original request, finding empty values, does not work and so far only search was broken. Wonder that we get not more user responses as many filter do not work.
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2020-04-12 23:55:52 +0200 (Sun, 12 Apr 2020) Revision:16284 Build-Date:2020-04-13 01:30:46 URL:https://josm.openstreetmap.de/svn/trunk
comment:15 by , 5 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
follow-up: 17 comment:16 by , 5 years ago
The search queries are not correct. So search for objects having the key, use sidewalk:
(not sidewalk=
) as shown in the search dialog since r16268.
follow-up: 18 comment:17 by , 5 years ago
Replying to simon04:
The search queries are not correct. So search for objects having the key, use
sidewalk:
(notsidewalk=
) as shown in the search dialog since r16268.
Please, have a closer look, the first and second search results are wrong and the third and fourth are not accepted.
Using josm_15943_example.osm:
type:way highway=* sidewalk=
finds way withhighway=footway
,footway=sidewalk
type:way highway=* -sidewalk=
does not find way withhighway=footway
,footway=sidewalk
type:way highway= sidewalk=
is marked as invalid searchtype:way highway: sidewalk:
is marked as invalid search
follow-up: 19 comment:18 by , 5 years ago
(Normally, we try to avoid exhuming 2 year old tickets to start a long discussion. This one has been fixed for 18.02 and might have gone in the corresponding release notes.)
Firstly, can we agree that testing for an empty value ""
is equivalent to testing that the value is absent? – way highway=""
≣ way
(Normal OSM objects do not have empty values, JOSM does not allow setting empty values.)
In the following, I'm using ≣ to mean "semantically equivalent".
Replying to skyper:
type:way highway=* sidewalk=
finds way withhighway=footway
,footway=sidewalk
sidewalk=
≣ sidewalk=""
≣ key sidewalk
is absent
type:way highway=* -sidewalk=
does not find way withhighway=footway
,footway=sidewalk
-sidewalk=
≣ negation of sidewalk=
≣ negation of sidewalk=""
≣ negation of key sidewalk
is absent ≣ key sidewalk
is present
Thus, I don't see a problem with 1. and 2.
type:way highway= sidewalk=
is marked as invalid searchtype:way highway: sidewalk:
is marked as invalid search
Not good, not intended, but can be worked around using parentheses such as type:way (highway=) (sidewalk=)
follow-up: 20 comment:19 by , 5 years ago
The ticket was closed on 2018-02-17 (comment:4) and reopened by the reporter on 2018-03-12 (comment:6). This was within one release circle. Should we leave fixed tickets with reached milestone closed, in general? Then it would be nice to have a trac warnning about it suggesting to create a new, follow up ticket.
Replying to simon04:
Replying to skyper:
type:way highway=* sidewalk=
finds way withhighway=footway
,footway=sidewalk
sidewalk=
≣sidewalk=""
≣ keysidewalk
is absent
No, sidewalk=
≣ sidewalk=""
≣ key sidewalk
with empty value present
type:way highway=* -sidewalk=
does not find way withhighway=footway
,footway=sidewalk
-sidewalk=
≣ negation ofsidewalk=
≣ negation ofsidewalk=""
≣ negation of keysidewalk
is absent ≣ keysidewalk
is present
No, -sidewalk=
≣ negation of sidewalk=
≣ negation of sidewalk=""
≣ negation of key sidewalk
with empty value present ≣ key sidewalk
with empty value is not present
I think it would be better to use ""
for empty values and drop key=
. Sadly, I was not able to test the behavior before r13430 as the example file is not opening but produces an exception.
comment:20 by , 5 years ago
follow-up: 22 comment:21 by , 5 years ago
Once it's clear if something needs to be fixed, please create a new ticket.
comment:22 by , 5 years ago
Replying to Don-vip:
Once it's clear if something needs to be fixed, please create a new ticket.
I usually do, but as said, this ticket was "reopened" when I started to comment and was changed to "fixed" within this milestone. That is the reason I did reopen within 48 hours.
I would rather say that
key=
is wrong, it should bekey
. Then it matches with the tooltip and its behavior.I'm not sure if it is even possible in the osm database to have emtpy values.