WorldWideTelescope / wwt-webgl-engine

The full WorldWide Telescope rendering engine in JavaScript with WebGL
https://docs.worldwidetelescope.org/webgl-reference/latest/
MIT License
20 stars 10 forks source link

Improve matching logic in getImagesetByName #33

Open astrofrog opened 5 years ago

astrofrog commented 5 years ago

Currently the string matching logic in getImagesetByName can cause issues:

        if (imageset.get_name().toLowerCase().indexOf(name.toLowerCase()) > -1) {
          return imageset;
        }

In principle, this means that if there were three surveys such as GLIMPSE, GLIMPSE 360, and GLIMPSE/MIPSGAL, asking for the GLIMPSE imagery could match any of the three - but I think priority should be given to exact matches.

I think it would make sense to first check for any exact matches, then do a second pass with the fuzzy matching above.

pkgw commented 5 years ago

I also find the existing mechanism to be a bit worrisome. The ImageSets property is a List, so its behavior will be deterministic during any given run, but I could imagine confusing behavior if people load up collections in different orders from one run to the next. @astrojonathan would adding a preference for an exact match cause any problems that you can think of?

astrojonathan commented 5 years ago

I think an exact match, and if not found a "most complete match" would be a good way to address the issue.

On Wed, Jul 3, 2019 at 6:17 AM Peter Williams notifications@github.com wrote:

I also find the existing mechanism to be a bit worrisome. The ImageSets property is a List, so its behavior will be deterministic during any given run, but I could imagine confusing behavior if people load up collections in different orders from one run to the next. @astrojonathan https://github.com/astrojonathan would adding a preference for an exact match cause any problems that you can think of?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/WorldWideTelescope/wwt-web-client/issues/228?email_source=notifications&email_token=ACJYJD4FFWIKHELV5ZNDU2TP5SRFLA5CNFSM4H4KR252YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZENCIY#issuecomment-508088611, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJYJDYVX55SWDYUZXLIKELP5SRFLANCNFSM4H4KR25Q .