-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use unique IDs and allow partial matches when querying for names #12
Comments
There's no such concept in MediaWiki and no resource shall be considered static. That said, substance names are sufficiently stable for them to be considered IDs. We always create redirects if a substance article is moved, and the API respects redirects. Example: https://api.psychonautwiki.org/?query=query%7Bsubstances(query:%221plsd%22)%7Bname%7D%7D. The |
Cool! Still, IMO we should also have some method of querying that gives results that partially matches the query (similar behavior to the wiki's search bar). For example, if I search for "MD" (https://api.psychonautwiki.org/?query=query%7Bsubstances(query:%22MD%22)%7Bname%7D%7D), I should receive all of the following as results:
Maybe use the |
We're not using MongoDB. That said, it appears as though we could be using a PrefixSearch: https://psychonautwiki.org/w/api.php?action=query&list=prefixsearch&pssearch=LS&format=json. The only issue is that we're not working with a generic search endpoint but with a semantic search (based on meta data inside articles). I'll look into this. |
Hello, any update on this? Im trying to use the Apollo/GraphQL endpoint for a project and would really like prefix/post search capability <3 |
I guess the main identifier for substances is its name.
Should we have an additional nonmutable
id
field forSubstance
and maybeEffect
?Let's say we start using the names as the single source of truth for querying a substance. I'm not sure if this is a realistic scenario, but what if the name of a substance changes for some reason. The original query would be affected. This could lead to 404 errors, for instance.
It would also be nice to query for substances using its ID for a more assertive query. Right now, we use:
Query.substances
The response is an array, which suggests that we could have more than 1 result. This could be helpful for search boxes, like starting to type "25" and already get a list of the 25-NB family.
But still, I couldn't query a list of more than 1 result when searching for a partial name like "25" or "L", which I assume means that the query is searching for exact matches.
On the other hand, querying for an ID or slug could be useful for loading specific pages while being sure that they won't change. In this case, the result would be a single substance:
Query.substance
The text was updated successfully, but these errors were encountered: