MarcusWolschon / osmeditor4android

Vespucci is a OpenStreetMap editor for Android
http://vespucci.io
Other
381 stars 83 forks source link

Preset search seems random #450

Closed saraedum closed 8 years ago

saraedum commented 8 years ago

When I search for "wayside", I get "Wayside Shrine" and "Waste Disposal/Dumpster" but not "Wayside Cross". When I search for "view", I get all kinds of things, but not "Viewpoint". When I search for "gate", I get "Swing Gate" but none of the other gates, in particular, I do not see the plain "Gate".

I have observed this issue for about a year now. I could try to fix it myself. Could someone point me to the place in the code where things are likely going wrong?

simonpoole commented 8 years ago

That was fixed in https://github.com/MarcusWolschon/osmeditor4android/commit/3974dc7bb02943d1c42bf125c3cabb8f769a32b5 and https://github.com/MarcusWolschon/osmeditor4android/commit/403385a52940e7272ff654a8ee6c6fd513a0b9eb (note if you had opened a ticket a year ago, it would have been fixed then).

Builds including the fix may be available on google play this week.

saraedum commented 8 years ago

Sorry for the noise :)

simonpoole commented 8 years ago

See http://www.openstreetmap.org/user/SimonPoole/diary/39012 on how to obtain the build, due to google madness we can't update the release version on the play store, sorry.

saraedum commented 8 years ago

I tried the latest version. wayside works now. For view, I get Pier, Gift/Souvenir, Mini-Roundabout, Wind Turbine, Tee, Tires, Movie Theater/Cinema, Hearing Aids, Weir, Key cutter but not Viewpoint.

simonpoole commented 8 years ago

That is expected behaviour with the current search index and algorithm. Right now we use a fairly small search index and search through that with an algorithm that is similar to Damerau-Levenshtein. iirc we currently allow for 3 edits, this implies that very short terms will typically match nearly any other very short term.

In your example I suspect we are matching with

Pier Gift Mini Wind Tee Tires Movie Aids Weir Key

which are all short. "Viewport" is long and needs more than three "edits" to match with "View". What is easy to implement is a literal (post-normalization) sub-string search, but that would be non-fuzzy (or computationally rather expensive).

Long term solution is likely to move to an "on-disk" search index instead of in-memory and use a different algorithm.

simonpoole commented 8 years ago

substring matching added in https://github.com/MarcusWolschon/osmeditor4android/commit/7f9b33cd341d5335da7d1974fa82ac315cad8c7f