tonysun83 edited a comment on pull request #3912: URL: https://github.com/apache/couchdb/pull/3912#issuecomment-1021665360
Pretty neat feature! IIUC, these new virtual fields will usually lead to a full key range scan because the answer derived by from the jq query will be what the user wants. Ex: "Give me all docs where foo does not contain 1,2, or 3.": ``` {"foo" : {"$nin": [1, 2, 3]} ``` Currently, we don't use an index for this query, so we'll scan `_all_docs` and then run the filter. Now with this new feature, you can have a precompiled jq query that filters all `foo` fields that don't have 1,2,3: ``` { "foo_words": { "$jq": ".foo | <some expression to get all all values not in [1,2,3]> | .[]" } } ``` ``` Doc1 {"foo": "1"} Doc2 {"foo": "4"} Doc3 {"foo": "5"} ``` The table with the new feature would look like: ``` foo_words, 4 foo_words, 5 ``` From the original query, the user wants 4,5 back. So the query would `{"foo_words" : {"$gt" : null}} I'm thinking this would be more common than the user having a precompiled jq, filtering the results and then running another query on top of that. Perhaps we can think of just doing the full key range scan (from the emitted keys) for them to make things simpler? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org