Modify

Opened 7 years ago

Last modified 5 years ago

#15943 reopened defect

Misbehaviour or wrong description of search string 'key='

Reported by: selfishseahorse@… Owned by: team
Priority: normal Milestone: 18.02
Component: Core Version: tested
Keywords: template_report search dialog Cc:

Description (last modified by Klumbumbus)

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?

  1. Ctrl + F
  2. 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)

josm_15943_example.osm (1.1 KB ) - added by skyper 5 years ago.
sample file

Download all attachments as: .zip

Change History (23)

comment:1 by Klumbumbus, 7 years ago

Milestone: 18.02

I would rather say that key= is wrong, it should be key. 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.

comment:2 by Klumbumbus, 7 years ago

Description: modified (diff)

comment:3 by selfishseahorse@…, 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:4 by Don-vip, 7 years ago

Resolution: fixed
Status: newclosed

In 13430/josm:

fix #15943 - allow to search empty values

comment:5 by Klumbumbus, 7 years ago

In 13432/josm:

see #15943 - adjust search hints. reorder, fix key= to key and add the new key=

comment:6 by selfishseahorse@…, 7 years ago

Resolution: fixed
Status: closedreopened

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 value
  • type:way highway -sidewalk also filters footway=sidewalk, but in footway=sidewalk, sidewalk is the value, not the key

JOSM version used: 13500

by skyper, 5 years ago

Attachment: josm_15943_example.osm added

sample file

comment:7 by skyper, 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
  1. type:way highway=* sidewalk=
  • type:way highway -sidewalk also filters footway=sidewalk, but in footway=sidewalk, sidewalk is the value, not the key
  1. 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 with footway=sidewalk
  • type:way highway=* -sidewalk= does not find highway=footway with footway=sidewalk
  • type:way highway= sidewalk= is marked as invalid expression and not accepted

comment:8 by GerdP, 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 skyper, 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.

Last edited 5 years ago by skyper (previous) (diff)

comment:10 by simon04, 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

     
    291291                .addKeyword("-<i>key</i>:<i>valuefragment</i>", null, tr("''valuefragment'' nowhere in ''key''")),
    292292                GBC.eol());
    293293        hintPanel.add(new SearchKeywordRow(hcbSearchString)
    294                 .addKeyword("<i>key</i>", null, tr("matches if ''key'' exists"))
    295294                .addKeyword("<i>key</i>=<i>value</i>", null, tr("''key'' with exactly ''value''"))
    296295                .addKeyword("<i>key</i>~<i>regexp</i>", null, tr("value of ''key'' matching the regular expression ''regexp''"))
    297296                .addKeyword("<i>key</i>=*", null, tr("''key'' with any value"))

comment:11 by simon04, 5 years ago

In 16268/josm:

see #15943 - SearchDialog: fix search hint to search for existing key

comment:12 by simon04, 5 years ago

Resolution: fixed
Status: reopenedclosed

comment:13 by simon04, 5 years ago

Keywords: search dialog added

comment:14 by skyper, 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 skyper, 5 years ago

Resolution: fixed
Status: closedreopened

comment:16 by simon04, 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.

in reply to:  16 ; comment:17 by skyper, 5 years ago

Replying to simon04:

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.

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:

  1. type:way highway=* sidewalk= finds way with highway=footway, footway=sidewalk
  2. type:way highway=* -sidewalk= does not find way with highway=footway, footway=sidewalk
  3. type:way highway= sidewalk= is marked as invalid search
  4. type:way highway: sidewalk: is marked as invalid search
Last edited 5 years ago by skyper (previous) (diff)

in reply to:  17 ; comment:18 by simon04, 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:

  1. type:way highway=* sidewalk= finds way with highway=footway, footway=sidewalk

sidewalk=sidewalk="" ≣ key sidewalk is absent

  1. type:way highway=* -sidewalk= does not find way with highway=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.

  1. type:way highway= sidewalk= is marked as invalid search
  2. type: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=)

in reply to:  18 ; comment:19 by skyper, 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:

  1. type:way highway=* sidewalk= finds way with highway=footway, footway=sidewalk

sidewalk=sidewalk="" ≣ key sidewalk is absent

No, sidewalk=sidewalk="" ≣ key sidewalk with empty value present

  1. type:way highway=* -sidewalk= does not find way with highway=footway, footway=sidewalk

-sidewalk= ≣ negation of sidewalk= ≣ negation of sidewalk="" ≣ negation of key sidewalk is absent ≣ key sidewalk 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.

in reply to:  19 comment:20 by Don-vip, 5 years ago

Replying to skyper:

Should we leave fixed tickets with reached milestone closed, in general?

Yes

comment:21 by Don-vip, 5 years ago

Once it's clear if something needs to be fixed, please create a new ticket.

in reply to:  21 comment:22 by skyper, 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user. Next status will be 'new'.
Next status will be 'needinfo'. The owner will be changed from team to selfishseahorse@….
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.