You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are at least 2 pieces of static value sugar I think are needed for secondary indexes:
# indexing a field, the following are equivalenttable.index("foo")
table.index("foo", "foo")
table.index("foo", lambdax: x["foo"])
# compound indexes, the following are equivalenttable.index(["foo", "bar"]) # This one seems questionabletable.index("foo_bar", ["foo", "bar"])
table.index("foo_bar", lambdax: [x["foo"], x["bar"]])
The first compound index notation seems questionable to me because it's not an immediately obvious name, on the other hand it's convenient and I can't see any way it's dangerous so it's probably okay.
Presumably these should be done server side rather than in the drivers.
I think table.index_create('name') is a good shortcut since 99% of the time people create indexes on attributes. Having to say table.index_create('foo', 'foo') all the time can get pretty annoying :)
Considering there'll also be the option of naming a basic index (with signature index_create(string, string)), things will get confusing: which is the name of index (first or second parameter)?
Activity
coffeemug commentedon Apr 5, 2013
I'd replace
indexwithindex_create. I'd drop the compound one you marked as questionable. Everything else seems awesome.al3xandru commentedon Apr 8, 2013
We should try to stay close to the API we provide around databases and tables:
For
index_createwe can probably have the following supported:coffeemug commentedon Apr 8, 2013
I think
table.index_create('name')is a good shortcut since 99% of the time people create indexes on attributes. Having to saytable.index_create('foo', 'foo')all the time can get pretty annoying :)al3xandru commentedon Apr 9, 2013
Considering there'll also be the option of naming a basic index (with signature
index_create(string, string)), things will get confusing: which is the name of index (first or second parameter)?coffeemug commentedon Apr 17, 2013
Closing as dup of #602.