Skip to content

Make 'r.desc' work for compound indexes #3779

Open

Description

@elifarley

I need to sort by descending order on the Nth attribute of a compound index (for numeric AND non-numeric attributes).

Example:

Consider table product: {name, category, count}
r.table("product_counts").index_create("productcategory-then-count", [ r.row["category"], r.desc(r.row["count"]) ] ) >>> Doesn't compile
r.table("product_counts").order_by(index="productcategory-then-count")
{name: "apple", category: "cat-a", count: 46}
{name: "laptop", category: "cat-b", count: 38}
{name: "tablet", category: "cat-b", count: 37}
{name: "vodka", category: "cat-c", count: 59}
{name: "car", category: "cat-d", count: 82}

Activity

  1. danielmewes commented on Feb 13, 2015

    @danielmewes
    Member

    This is definitely a useful feature and I also like the interface. Thanks for opening the issue @elifarley

    I think this is easiest to implement once we have custom btree comparison functions. This is something we want to do anyway to support Unicode collations, so that shouldn't be too far away.

  2. added this to the subsequent milestone on Feb 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions