Modify

Opened 4 months ago

Closed 3 months ago

Last modified 3 months 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 4 months ago.
preset-search.patch (5.2 KB) - added by bafonins 4 months ago.
preset-search-v2.patch (5.7 KB) - added by bafonins 4 months ago.
Refactored the code a bit
preset-search-v3.patch (10.0 KB) - added by bafonins 3 months ago.
Fixed the issue and added tests
en-search-dialog-expert.jpg (181.8 KB) - added by bafonins 3 months ago.
The search dialog, expert mode, english
en-search-dialog.jpg (105.3 KB) - added by bafonins 3 months ago.
The search dialog, regular mode, english
ger-search-dialog-exp.jpg (205.8 KB) - added by bafonins 3 months ago.
The search dialog, expert mode, german
preset-search-v4.patch (29.1 KB) - added by bafonins 3 months ago.

Download all attachments as: .zip

Change History (22)

Changed 4 months ago by bafonins

Attachment: preset-search..jpg added

Changed 4 months ago by bafonins

Attachment: preset-search.patch added

comment:1 Changed 4 months ago by bafonins

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

comment:2 Changed 4 months ago by bafonins

Description: modified (diff)

comment:4 Changed 4 months ago by michael2402

Description: modified (diff)

comment:5 Changed 4 months ago by stoecker

Milestone: 17.06

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

comment:6 Changed 4 months ago by michael2402

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

comment:7 in reply to:  6 ; Changed 4 months ago by 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.

Changed 4 months ago by bafonins

Attachment: preset-search-v2.patch added

Refactored the code a bit

comment:8 in reply to:  7 Changed 4 months ago by michael2402

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 4 months ago by michael2402 (next)

Changed 3 months ago by bafonins

Attachment: preset-search-v3.patch added

Fixed the issue and added tests

comment:9 Changed 3 months ago by michael2402

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

comment:10 Changed 3 months ago by bafonins

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

comment:11 Changed 3 months ago by michael2402

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.

Changed 3 months ago by bafonins

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

The search dialog, expert mode, english

Changed 3 months ago by bafonins

Attachment: en-search-dialog.jpg added

The search dialog, regular mode, english

Changed 3 months ago by bafonins

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

The search dialog, expert mode, german

comment:12 Changed 3 months ago by bafonins

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?

Changed 3 months ago by bafonins

Attachment: preset-search-v4.patch added

comment:13 Changed 3 months ago by michael2402

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 Changed 3 months ago by Don-vip

In 12467/josm:

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

comment:15 Changed 3 months ago by Don-vip

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.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.