Skip to content

Desc Sorting with start_val in filtered collection not working properly #391

@joepio

Description

@joepio

I was creating this query, which both filters (by val and prop) and sorts by a different property than the filter.

    let query_children = Query {
        property: Some(PARENT.into()),
        value: Some(Value::AtomicUrl(resource.get_subject().clone())),
        limit: Some(page_limit + 1),
        start_val: Some(Value::Timestamp(start_val)),
        end_val: None,
        offset: 0,
        sort_by: Some(urls::CREATED_AT.into()),
        sort_desc: false,
        include_external: false,
        include_nested: false,
        for_agent: for_agent.map(|s| s.to_string()),
    };

The result is that the sort is not proper. After checking out the saved keys, it becomes apparent that the server is storing the wrong value in the index key, namely the filter value instead of the sort value.

I should add a failing test for this.

Edit: No, it's more specific. It's using a start_val in descending order. That's the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions