alexloney / reddit_marvel_snap_card_bot

u/MarvelSnapCardBot2 on Reddit
MIT License
2 stars 0 forks source link

Prefer exact card match #19

Closed alexloney closed 8 months ago

alexloney commented 8 months ago

This closes #18, when viewing matching results, I found that a user could search for [[Death]] but it would return results for:

While I can see why these matched, since "Death" was included in all of them, it does provide a slightly misleading result, since it is pretty obvious that a user would like to see the card "Death" and not the other locations.

To resolve this, I've updated the matching to prefer an exact match to the full text first. If no exact match is found, then it will pull in the other matches. This will allow someone searching for [[Death]] to match to exactly the card "Death" and not the other partial-matches.

If the original search is not spelled correctly, for example if it is [[Daeth]], then this will bypass the logic above and will pull in partial matches.

Additionally, this updates the CI/CD pipeline to require test to be completed before it builds the Docker container.