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
Keep and expose pretty-printed index functions #3231
Comments
Thank you @AtnNn ! |
That's a good idea. In NoBrainer, I'm planning to store the index definitions in a separate table so that I can check if index definitions have changed. I'd much rather populate that "source" thing. 👍 |
This will become pretty easy once we have #3636 |
Just needed this again when debugging something that a user ran into. The output isn't perfect, but I think it's worth shipping this even if we later redo it in a nicer way. Sorry for not adhering to the ReQL_proposal standards, but I think the absence of this feature is sufficiently annoying for debugging that we should just ship it. The {
"function": <binary, 127 bytes, "24 72 65 71 6c 5f..."> ,
"geo": false ,
"index": "parent_folder_id" ,
"multi": false ,
"outdated": true ,
"ready": true ,
"source": 'function (captures = [(no implicit)]) (args = [1]) var1("data")("parent_folder_id")'
} |
In CR 3288. It's just a two-line addition. |
We decided to redo this a bit and actually generate the JS query that you can use to re-create the index (and call the field "query"). |
Merged into r.table('t1').indexStatus().pluck("query")
[
{
"query": "indexCreate('a', function(_var19) { return _var19.getField("a"); })"
} ,
{
"query": "indexCreate('b', function(_var19) { return _var19.getField("b"); }, {geo: true})"
} ,
{
"query": "indexCreate('c', function(_var19) { return _var19.getField("c"); }, {multi: true, geo: true})"
} ,
{
"query": "indexCreate('d', function(var24) { return r.expr([var24("a"), var24("b").count()]); })"
}
] |
There could be a "source" optarg to
indexCreate
that is kept by the server and exposed as-is throughindexStatus
.The drivers could automatically populate the optarg with the pretty-printed index function.
If the field is missing, the server could set it to a basic representation of the query (perhaps as an s-expression).
The text was updated successfully, but these errors were encountered: