Tuesday, July 13, 2021
I like to keep up with the UFC, but I have not seen every fight that ever took place - I have not seen most of them. Sometimes I like to check out a fighter's history and look for an interesting fight to watch, or if I missed the latest event, I want to see who fought on it; but I don't want anything spoiling. Spoilers are everywhere, particularly if you did not watch the latest event live. One clumsy Google search and the results will be made very apparent. There wasn't really anywhere you could go to get this information without the spoilers, so I made my own place for it at liamfoot.com/ufc.
The Landing page - you can scroll through all UFC events, or search by fighter name.
This is the Landing page, residing at liamfoot.com/ufc. You can scroll through the entire list of events, and click any of them to see who fought who on which card, without seeing the results.
Event Page for UFC 264: Poirier vs McGregor 3
When clicking into a specific event, the fights can be seen without the results. Each time the page is loaded, the fighter positions are randomized - so unlike Wikipedia, the winner is not always on the left side. All results are hidden by default, but can be revealed if desired - either selectively, or for the entire event. When hovering a spoiler button, the row turns red as a guide.
Fighter Page - showing Stipe Miocic's fight history.
At the top of the Landing page, there is a search box. This box provides near real-time search results by fighter name, and takes you to a given fighter's Fighter page. This page lists all of a given fighter's UFC fights, and the events and fighters displayed can be clicked through.
Throughout this web app, red buttons are used for definite spoilers, whereas orange/yellow buttons are for less sensitive spoilers. It is possible that many people will not consider a fighter's overall UFC record, in terms of wins/losses/draws/no contests, to be a spoiler; so the button to show that is orange/yellow.
All of the data is sourced from Wikipedia, as linked at the top of the Landing page. Wikipedia is a fantastic information source, and understandably, they cannot tailor their data to everyone's needs - that's why I built something around their product.
I do not want to hit them with too many requests, so I do my best to be economical with regards to fetching the data. I built a web scraper that stores the data in my own database, so that all data is served from my server rather than from Wikipedia. The scraper runs periodically through a window of a few hours on Sunday mornings in UTC, covering the time period where the event is wrapping up and Wikipedia is being updated with the results.
I found the full-text searching performance of a Lucene index to be a bit faster than SQL Server Full Text Search, even for this small data set. Usually Lucene would give me a search result in around 3/4 of the time it takes SQL Server Full Text Search, but sometimes it could be as soon as 1/3 of the time. Additionally, Entity Framework still does not support the appropriate conversions to even use SQL Server Full Text Search, which is a bit surprising given how long this feature has now been unavailable - For testing purposes I worked around it with a stored procedure. SQL Server Full Text Search is much easier to configure so it's not bad for what it provides - automatic index management, indexing times on the order of a few seconds vs. six-something minutes for Lucene, for this small dataset; and less to go wrong in general. I noticed that Lucene will only use a single processor for its index optimization, which can't be helping things as it maxes out that processor through the entire duration of indexing - it is clearly a CPU limited process on my 4.9GHz Coffee Lake processor that it is using. This is for Lucene.NET version 3, which I selected due to it already being integrated into Umbraco, and not wanting more out of process services to manage.
It's fun to experiment with things but I would stick with SQL Server Full Text Search for production workloads, unless I needed the extra performance or configuration options of Lucene.
If you want quick access to spoiler-free UFC events, make sure to bookmark liamfoot.com/ufc!