Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14923 closed enhancement (fixed)

[patch] JOSM search by preset in the search dialog

Reported by: bafonins Owned by: team
Priority: normal Milestone: 17.07
Component: Core Version:
Keywords: Cc: michael2402

Description (last modified by michael2402)

Currently, there are two menu entries to perform searching - "Search" and "Search for object by preset...". And functionality to search for osm objects is very limiting, namely there is no way to search for two or more presets at the same time, it is not possible to add object that match the preset to the current selection and etc.
I propose to merge these dialogs, actually adding functionality to search for presets to the search dialog. Then queries like
preset:water | preset:waterway or
preset:Village | preset:"Cave Entrance" | highway=motorway
can be performed + the selection settings from the search dialog can be used to control selected objects.

Also, we can embed the "Search for objectsby preset..." dialog intro the "Search" dialog in order to simply select needed presets and append 'preset:...' query to the text field.


Attachments (8)

preset-search..jpg (120.7 KB ) - added by bafonins 7 years ago.
preset-search.patch (5.2 KB ) - added by bafonins 7 years ago.
preset-search-v2.patch (5.7 KB ) - added by bafonins 7 years ago.
Refactored the code a bit
preset-search-v3.patch (10.0 KB ) - added by bafonins 7 years ago.
Fixed the issue and added tests
en-search-dialog-expert.jpg (181.8 KB ) - added by bafonins 7 years ago.
The search dialog, expert mode, english
en-search-dialog.jpg (105.3 KB ) - added by bafonins 7 years ago.
The search dialog, regular mode, english
ger-search-dialog-exp.jpg (205.8 KB ) - added by bafonins 7 years ago.
The search dialog, expert mode, german
preset-search-v4.patch (29.1 KB ) - added by bafonins 7 years ago.

Download all attachments as: .zip

Change History (22)

by bafonins, 7 years ago

Attachment: preset-search..jpg added

by bafonins, 7 years ago

Attachment: preset-search.patch added

comment:1 by bafonins, 7 years ago

Summary: JOSM search by preset in the search dialog[patch] JOSM search by preset in the search dialog

comment:2 by bafonins, 7 years ago

Description: modified (diff)

comment:4 by michael2402, 7 years ago

Description: modified (diff)

comment:5 by stoecker, 7 years ago

Milestone: 17.06

Note before applying: Typo in the first line "all object_s_".

comment:6 by michael2402, 7 years ago

There is a github PR for this patch. Commenting is easier there. I did a review on it - especially to address some coding style issues:

https://github.com/openstreetmap/josm/pull/19

in reply to:  6 ; comment:7 by stoecker, 7 years ago

Replying to michael2402:

There is a github PR for this patch. Commenting is easier there.

No it is not. It is already enough work to react to one bug-tracker. Starting to react to different places is not a good idea.

by bafonins, 7 years ago

Attachment: preset-search-v2.patch added

Refactored the code a bit

in reply to:  7 comment:8 by michael2402, 7 years ago

Replying to stoecker:

Replying to michael2402:

There is a github PR for this patch. Commenting is easier there.

No it is not. It is already enough work to react to one bug-tracker. Starting to react to different places is not a good idea.

For conceptional issues I agree. But my comments were more on stylistic issues (variable names, inverting equals, using blocks in if/else, ...)

@bafonins: You patch looks better that way ;-). Cann you add test cases to it to the SearchCompilerTest? Especially for:

`
preset:"water" (Test if it matches correctly)
preset:water (Test if it matches correctly)
preset: water (Test if it matches correctly)
preset: (Should throw a ParseError)
preset:xyz (Should throw a ParseError)
`

Version 0, edited 7 years ago by michael2402 (next)

by bafonins, 7 years ago

Attachment: preset-search-v3.patch added

Fixed the issue and added tests

comment:9 by michael2402, 7 years ago

@bafonins: Should I merge this patch now or wait for your work on your future work?

comment:10 by bafonins, 7 years ago

Do not merge it now, there are still things to be done.

comment:11 by michael2402, 7 years ago

Milestone: 17.0617.07

Moving this until after the 17.6 release - the patch should be ready before then but we should have time to fix issues.

by bafonins, 7 years ago

Attachment: en-search-dialog-expert.jpg added

The search dialog, expert mode, english

by bafonins, 7 years ago

Attachment: en-search-dialog.jpg added

The search dialog, regular mode, english

by bafonins, 7 years ago

Attachment: ger-search-dialog-exp.jpg added

The search dialog, expert mode, german

comment:12 by bafonins, 7 years ago

With this update GUI of the search dialog changed a bit. New hints added, as well as a list of possible presets to search for.
The search dialog, regular mode, english
The search dialog, expert mode, english
The search dialog, expert mode, german

After clicking on any preset in the selector, a corresponding string is generated and appended to the text field. Autocomplete is working and in case of selecting some preset that starts already used query, the generated part is selected. And of course, presets can be combined into more sophisticated queries as you usually do with types, names, logical operators, etc.

So, searching works as follows :
Annotation/Address - a regular query that matches all object that have the corresponding preset
Annotation/* - a wildcard query that matches all object that have any preset of the group Annotation

Any suggestions?

by bafonins, 7 years ago

Attachment: preset-search-v4.patch added

comment:13 by michael2402, 7 years ago

Resolution: fixed
Status: newclosed

In 12464/josm:

Apply #14923: Adjust the search dialog to allow to search for primitives that use a preset. Patch by bafonins

comment:14 by Don-vip, 7 years ago

In 12467/josm:

see #14923 - PMD - UseIndexOfChar - String.indexOf(char) is faster than String.indexOf(String)

comment:15 by Don-vip, 7 years ago

In 12468/josm:

see #14923 - suppress java warnings

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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