iftechfoundation / ifdb

The software behind the Interactive Fiction Database (IFDB)
Other
23 stars 18 forks source link

Fix implicit search by TUID #353

Closed dfabulich closed 3 days ago

dfabulich commented 4 days ago

You're supposed to be able to paste a TUID into IFDB search, with no operator, and have it just work, but we broke it when we removed implicit search by IFID.

dfabulich commented 3 days ago

I'm not sure I follow your suggestion. I'd initially made the search by TUID part of the main search query, but it caused a big performance regression. https://github.com/iftechfoundation/ifdb/issues/475

I couldn't figure out how to fix it, so I just did two searches, one by TUID, and then the rest of the search.

salty-horse commented 3 days ago

I meant just doing this. The query is too simple to log for debugging purposes, and keeping the actual query string together with the call makes it easy to verify that the number of question marks matches the number of items in the list.

-        $sql = "select games.id as gameid from games where games.id = ?";
-        if ($logging_level) {
-            error_log($sql);
-            error_log($words[0]);
-        }
-        $result = mysqli_execute_query($db, $sql, [$words[0]]);
+        $result = mysqli_execute_query($db,
+            "select games.id as gameid from games where games.id = ?",
+            [$words[0]]);