44 Commits

Author SHA1 Message Date
Martin Raifer
58f597165b match shortest possible name or alias when sorting presets
improves preset matching in cases like https://github.com/openstreetmap/id-tagging-schema/issues/632
2022-11-04 10:06:20 +01:00
Bryan Housel
2b2a71f597 Don't pre-resolve and index complex locationSets into GeoJSON.
This was taking a lot of time at app startup.

Instad now we resolve and index only the include and exclude parts.
We can still determine the valid locationSets at runtime in `locationSetsAt()`
by checking the `_locationIncludedIn` and `_locationExcludedIn` caches.

This also upgrades the locationManger to an ES6 class.

This also includes some hacky code in nsi.js so that the NSI will continue to work.
The NSI matcher can build its own location index, but it doesn't need to do this.
We monkeypatch a few of the matcher collections to work with the new LocationManager.
2022-10-28 10:49:01 -04:00
Martin Raifer
4a55249dee fix code style issues 2022-05-25 13:45:55 +02:00
Martin Raifer
29d4ab6866 search presets by tag "key=value" syntax
closes #8869
2022-05-25 10:58:08 +02:00
Martin Raifer
d486ab197d sort preset search results by matching aliases, add tests 2022-05-25 10:25:29 +02:00
Martin Raifer
8796a412f8 support aliases in preset search
closes #6139
2022-05-24 17:15:01 +02:00
Bryan Housel
3cf5f69082 Allow missing locationSetID on presets, fields, categories
This simplifies the code a bit, just treat it as worldwide if missing
2021-03-12 12:27:50 -05:00
Bryan Housel
f39f73e3ae Make sure suggestion preset terms get used in the search 2021-01-18 15:02:07 -05:00
Bryan Housel
271e1c2e19 Use locationManager to filter fields/presets/defaults 2021-01-08 16:06:57 -05:00
Quincy Morgan
6cd81df1a2 Fix preset search result sorting (re: #8242) 2020-12-21 11:26:34 -05:00
Quincy Morgan
2591a13f9c Honor diacritics on preset search value but still compare to stripped preset names (re: #8242) 2020-12-21 11:14:10 -05:00
Quincy Morgan
d57ed85e98 Merge branch develop 2020-12-16 11:43:36 -05:00
Quincy Morgan
b3ad282f40 Ignore diacritics when searching presets (close #8242) 2020-12-09 17:12:43 -05:00
Quincy Morgan
baabd81987 Unbundle id-tagging-schema data and translations
Update for id-tagging-schema 2.0.0
2020-12-01 11:14:14 -05:00
Quincy Morgan
2769ac87f1 Support territories in preset and field country limiters (re: #8102) 2020-10-21 18:21:17 -04:00
Quincy Morgan
47ae71ce16 Revert "Support territories in preset and field country limiters (re: #8102)"
This reverts commit a3a9259859.
2020-10-21 18:17:52 -04:00
Quincy Morgan
a3a9259859 Support territories in preset and field country limiters (re: #8102) 2020-10-19 13:12:05 -04:00
Bryan Housel
e3e7cd3003 Memoize presetCollection.item (it's an Array.find)
Also add tests for `matchAllGeometry`
2020-02-05 10:32:20 -05:00
Bryan Housel
0fe766d9a4 WIP on external presets
- preset data is no longer bundled into iD.js
- some code pathways commented out re: external presets
- many changes so that tests can run without presets at start, or async
- still need to make sure fallbacks are always there (point, line, area, etc)
2020-02-05 09:38:26 -05:00
Quincy Morgan
6bb2997306 Enable changing the preset of multiple selected features (re: #7276)
Fix issue where preset tag reference wouldn't load
Change "Change feature" tooltip to more accurate "Change feature type"
2020-01-21 15:19:51 -05:00
Quincy Morgan
8b1c9fe323 Add notCountryCodes presets property to blacklist certain presets from certain countries
Show "Cycle & Foot Path" preset in all countries except France (re: #6836)
2019-09-17 13:54:59 -04:00
Bryan Housel
b09b43f6d3 Trim the user's string when preset searching
(closes #6383)
2019-05-19 21:37:09 -04:00
Quincy Morgan
b12e7277df Add countryCodes property to preset schema
Copy countryCodes from name suggestion index
Use countryCodes to filter the preset search results (close #6124)
2019-03-28 11:44:05 -04:00
Bryan Housel
5b4aa529de Replace lodash uniq
(re: 6087)
2019-03-27 02:43:25 -04:00
Bryan Housel
1ce4f0ad6a Remove lodash without
(re: #6087)
2019-03-25 21:56:54 -04:00
Bryan Housel
7e6f68a1b2 Remove lodash some
(re: #6087)
2019-03-23 00:07:52 -04:00
Bryan Housel
ff4f8f005f Remove lodash find and findIndex
(re: #6087)
2019-03-22 17:31:41 -04:00
Bryan Housel
11bfeaabfc Add browser-polyfills, remove lodash assign, compact, values
(re: #6087)
2019-03-22 17:14:41 -04:00
Quincy Morgan
7e92f6aa89 Combine vertex and point geometries into a single Point fallback preset 2019-03-18 12:36:20 -04:00
Quincy Morgan
d99fe79b6e Always show generic presets when searching 2019-03-04 17:47:20 -05:00
Quincy Morgan
4a82604cab Add search-to-add functionality 2019-02-28 15:00:00 -05:00
Bryan Housel
17bbc3d5a2 Slightly improve suggestion placement, preset search performance
- avoid lodash _filter when native filter is ok for arrays
- for suggestions use `originalName` instead of adding/removing the en-dash
- bump up importance of leading suggestions, but do a strict leading search

more on that last point:
For normal presets, we count a string as leading if it follows a space.
e.g. "office" will match "Law Office"
We don't really want this for suggestion presets though
e.g. "bell" should not match "Taco Bell"
2019-01-29 21:56:23 -05:00
Max Grossman
8f33a85a12 make collection.index function to handle failing tests 2018-12-17 17:16:10 -05:00
Bryan Housel
622621ca89 Improve suggestion combo behavior in the name field
- adds minItems(1) so it will match
- displays up to 10 suggestions
- correctly removes old tags by setting the `undefined`
- adjust the name distance scoring
- only shows name suggestions if the preset can benefit from them
  (i.e. a generic/fallback or a preset that has some suggestions in the index)
2018-11-21 11:15:03 -05:00
Bryan Housel
d53e473474 Convert lodah-es and d3 to named imports for presets 2017-09-25 14:20:24 -04:00
Bryan Housel
0d35c5ed59 Give preset priority in preset list when search matches name exactly
(closes #4325)
2017-09-10 12:56:14 -04:00
Bryan Housel
87618f9a6b Make it so preset.init() can be called again to reset the datastructures
(this is mostly so I can reset recent.collection for the walkthrough)
2017-04-11 22:34:02 -04:00
Bryan Housel
5e7919e78c Consider matchScore when sorting the preset list 2017-03-12 19:01:15 -04:00
Bryan Housel
3102a4ae6a Rename all the things to include pseudonamespaces 2016-10-04 19:06:20 -04:00
Tom MacWright
604d1e2719 import lodash (#3257) 2016-07-19 12:04:16 -04:00
Bryan Housel
0b3df36da0 Replace diacritics when doing fuzzy searches
(closes #3159)
2016-07-07 23:54:00 -04:00
Kushan Joshi
25485c40fb external modules for presets 2016-06-22 12:34:43 +05:30
Kushan Joshi
320434e8bb Add internal modules to preset 2016-06-22 12:34:43 +05:30
Beau Gunderson
4dbce64b7d migrate presets to ES6 modules for #3118 2016-06-14 20:44:05 -07:00