-
Notifications
You must be signed in to change notification settings - Fork 0
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
Consider embedding resources in responses instead of IDs #1
Comments
Hi @mosheduminer, thanks so much for the feedback! I really appreciate the interaction! The point of this process is to get exactly the kind of feedback you're giving me so I want to respond but please push back/let me know your thoughts. 1. Base64 encoding I had considered doing something like this. It's (mostly) not impossible to use
2. Returning Words instead of IDs I think I'm a bit confused by this suggestion so let me outline the way I'm understanding you. Correct me if I'm missing it. I'm imagining a query for phrases with בהו. Hitting {
"text_ids": [2],
"matching_words": [
[125]
],
"word_ids": [124, 125]
} At first I thought your suggestion was to put words in the
The point, though, is that I can query for the text with But now I'm thinking you mean instead of
Now that I think about this, I did want to give some way of sorting these results by canonical order (which is a versioned concept) and I'm realising the API doesn't have a way of doing that as it stands so I need to address that... Sorry for all the writing. I truly welcome your feedback! |
Yes, true. I believe Base64 lengthens the url by 33%. But it's worse using raw JSON, due to URL encoding. And even if you don't url encode, when sharing a link, the url is automatically URL encoded. This: If, however, it is quite conceivable that queries will be longer than the limit, then it could be an issue.
Yes, this is what I meant 🙂.
Yes, even if you didn't have the version problem, it might even still be preferable to have an boolean
I completely understand the problem. I suggested it because I understood you wanted to do exactly this (as per the link in my first comment). However, reading it again, it appears you only intended to paginate client side, but not at the API level. There is a downside to paginating at the API level, however. Because it means that the database query is run every time, even though only some results are returned. So it may actually be preferable to not paginate at the API level.
Different versions in fact have different orders? |
Okay, I've been letting this percolate for a while and I have a new idea: Instead of dumping the whole query into json, what about encoding the terms individually? I'm imagining queries that look something like this: That is:
I'm still thinking about the other comments regarding sending text content.
It's unusual but it happens (IIRC, there are few places this happens with the LXX in the Psalms). Thanks so much for the interaction! I deeply appreciate the feedback. |
So, the I think the url might look a little less like garbage with this technique, and you also gain a little bit by not encoding everything in base64. By the way, regarding URL character limits, it appears that most modern browsers do just fine many thousands of characters, according to this SO answer (note that the new edge browser, being chromium based, probably has the same limits as chrome). However, you might still have problems with URL length server side, but even then, it appears you can safely ise 4000 characters with apache server, for example. |
Yes.
Interesting. Thanks! I'm definitely coming round to this approach... |
@mosheduminer Just as a follow up, I have started experimenting with base64 encoding the params. This approach is quite appealing the more I think about it. Thanks very much for pushing me in this direction! |
Hi, I noticed the parabible project, and I like it. 👍
I read through the wiki here, in particular the
query
section. It does seem rather difficult to handle without POST requests, though I imagine you could do base64 encoding of the JSON if you don't mind it not being human readable, it's better than URL encodings, at least. (some discussion here https://softwareengineering.stackexchange.com/a/353105)However, I thought to comment on the response schema. It appears that you intend to return IDs, based upon which you can make further calls. I suggest the possibility of embedding words, instead of just the IDs. This has the advantage of requiring fewer API calls. Of course, this would make the response much larger, but if you paginate (which I saw you mentioned in the user interface section here, it shouldn't be too much of an issue.
Keep up the good work! 👍
The text was updated successfully, but these errors were encountered: