iftechfoundation / ifdb

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

Return tag synonyms in game tag search results #352

Closed dfabulich closed 1 day ago

dfabulich commented 4 days ago

Fixes https://github.com/iftechfoundation/ifdb/issues/806

For example, as I write this, Zeppelin Adventure is tagged "sci-fi" but not "science fiction". When I search for "adventure tag:science fiction" on ifdb.org, Zeppelin Adventure doesn't show up, but in this branch, it does show up, and in search results, it says: "tags matched: sci-fi"

image

There's no UI to edit tag synonyms, but that can come later, assuming I've got the schema right.

Am I right in thinking we want to allow synonyms to be asymmetrical? So searches for tag X return games tagged X or Y, but searches for tag Y don't necessarily return games tagged X? (That's why my tagsynonyms table has a fromtag and totag column.)

dfabulich commented 4 days ago

@alice-blue

alice-blue commented 3 days ago

It would be easier to experiment with this once some synonyms are already marked, but I'm wondering if it's still going to be possible to search tags without returning synonyms, in case someone wants to. I'm not sure of a use case for it, but I know I've run into e.g. a website trying to automatically adjust my search in a way that is actively unhelpful.

alice-blue commented 3 days ago

Am I right in thinking we want to allow synonyms to be asymmetrical? So searches for tag X return games tagged X or Y, but searches for tag Y don't necessarily return games tagged X? (That's why my tagsynonyms table has a fromtag and totag column.)

If we're going to have "official" tags and then "unofficial" synonyms that redirect to the official tags (kind of like a redirect page on a wiki, which exists just to send you to the correct page), then yes. If we're thinking of using this for tag suggestions, then I'm guessing we are going to want to suggest official tags if a user types an unofficial synonym, but we aren't going to want to suggest unofficial synonyms. (It's possible someone might want to search for all synonyms, though, even unofficial ones, outside the context of tag suggestions.)

dfabulich commented 3 days ago

It would be easier to experiment with this once some synonyms are already marked, but I'm wondering if it's still going to be possible to search tags without returning synonyms, in case someone wants to. I'm not sure of a use case for it, but I know I've run into e.g. a website trying to automatically adjust my search in a way that is actively unhelpful.

I'm open to that, but I'm not sure how it should work.

dfabulich commented 3 days ago

If we're going to have "official" tags and then "unofficial" synonyms that redirect to the official tags (kind of like a redirect page on a wiki, which exists just to send you to the correct page), then yes. If we're thinking of using this for tag suggestions, then I'm guessing we are going to want to suggest official tags if a user types an unofficial synonym, but we aren't going to want to suggest unofficial synonyms. (It's possible someone might want to search for all synonyms, though, even unofficial ones, outside the context of tag suggestions.)

I'm not sure I understand how you're thinking about this.

For "Tag Suggestions" https://github.com/iftechfoundation/ifdb/issues/843 I was imagining just doing a little search by tags as you type. So if you type "sci-" we'd suggest "sci-fi."

In my mind, that's fine, because the point of tag synonyms in search is so we don't have to actually edit all the games tagged "sci-fi" and tag them "science fiction." We don't even have to nudge people away from "sci-fi" towards "science fiction." We can just leave it alone, and searchers will get the right results anyway.

alice-blue commented 3 days ago

In my mind, that's fine, because the point of tag synonyms in search is so we don't have to actually edit all the games tagged "sci-fi" and tag them "science fiction." We don't even have to nudge people away from "sci-fi" towards "science fiction." We can just leave it alone, and searchers will get the right results anyway.

Ok, I was assuming that we were going to want to clean up the tags--i.e. change all "sci-fi" to "science fiction" or vice versa, in an automated way. In the tag table on the showtags page, I think it would be more helpful to see at a glance that there are (for example) 500 science fiction games, rather than 200 "sci-fi" games and then 300 "science fiction" games.

It seemed like there was at least some support for having fewer tags overall (for example, here), but maybe we never really reached consensus.

dfabulich commented 3 days ago

I've reopend this discussion back on the forum. https://intfiction.org/t/tagfest-2024-suggested-tag-consolidations/71371/31?u=dfabulich

I started to work on synonyms and immediately ran into confusion about what "synonyms" are supposed to do.

  1. Game-search synonyms: When you search games for "tag:science fiction", games tagged "sci-fi" would show up in search results.
  2. Bulk replace tags: A trusted/admin user would replace all the "sci-fi" tags with "science fiction" tags, so you can see that there are 500 games tagged "science fiction" rather than 300 games tagged "science fiction" and 200 games tagged "sci-fi".
  3. "Add Tag" enforces primary tags, banning synonyms: If you try to tag a game with "sci-fi", we'd require that you tag it with "science fiction" instead.

1 really isn't very compatible with 2 and 3. (What's the point in searching for "sci-fi" if we're just going to delete all the "sci-fi" tags?)

Similarly, I don't really know what "Tag suggestions" are supposed to do.

I think I know how to search for tags as you type, like autocomplete. (Maybe this would minimize some typos.)

But that's hardly "tag suggestions" in any meaningful sense. I have no idea how we'd decide to suggest tagging a game as "science fiction" before you start typing "sci." (But maybe nobody really meant that.)

Maybe all "tag suggestions" means is 3, so if you type "sci-" we'd recognize that you're referring to "sci-fi" but if you clicked on that autocomplete option, we'd "encourage" (require) you to tag it as "science fiction" instead.

I started working on 1 in this PR https://github.com/iftechfoundation/ifdb/pull/352 but it's not at all clear that it would even be used/useful if we're going to do 2 and 3.

dfabulich commented 1 day ago

I tentatively think I want to close this PR in favor of iftechfoundation/ifdb#521 and iftechfoundation/ifdb#519.

Given that "sci-fi" is the unwanted tag and that "science fiction" is the official tag, in this PR, I was imagining that you'd search for "science fiction" but still find all the "sci-fi" games as well.

But, in iftechfoundation/ifdb#521, I think we're just going to remove all the "sci-fi" tags, replacing them with "science fiction." So we no longer need any search synonyms.

I say "tentatively" because it could make sense to have someone search for tag:sci-fi and find all the "science fiction" games. But I don't think it's worth it.

  1. I don't really think anybody will do a search for tag:sci-fi after we delete all the sci-fi tags. The vast majority of tag: searches come from clicking on a tag on the viewgame page; hardly anybody will manually type out tag: and play that way.
  2. It will add complexity to searchutil.php, which is already very complicated performance-sensitive code.
  3. I'd have to add a message to the search results page explaining what I did, and why
dfabulich commented 1 day ago

Closing this for now; we can reopen it again if we feel the need.