Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:24:22+00:00 2026-06-15T20:24:22+00:00

Since zrange Lexicographical order is used for elements with equal score how do I

  • 0

Since zrange “Lexicographical order is used for elements with equal score” how do I go around this issue?

For example:

zadd s 0 1
zadd s 0 2
zadd s 0 10
zadd s 0 3

zrange s 0 4
1) 1
2) 10
3) 2
4) 3

How do I make it sort like this (while ofc honor the score):

1) 1
2) 2
3) 3
4) 10
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:24:23+00:00Added an answer on June 15, 2026 at 8:24 pm

    You cannot alter the lexicographic order.

    However, you could store a value whose lexicographic order matches with numerical order. For instance instead of storing:

    1
    2
    12
    15
    122
    321
    

    you could store:

    A1
    A2
    B12
    B15
    C122
    C321
    

    The first letter is just a code to indicate the number of digits of the numerical value (A=1, B=2, etc …), so that numerical and lexicographic order is the same. The client application can easily add/remove this prefix at store/retrieve time.

     zadd s 0 A1
     zadd s 0 A2
     zadd s 0 B10
     zadd s 0 A3
    
     zrange s 0 4
     1) "A1"
     2) "A2"
     3) "A3"
     4) "B10"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

since symbols do not respond to the <=> method used by sort, does anyone
since memcpy should be highly optimized nowadays, does it still make sense to optimize
Since now I have only used plugin for editing and the way I use
Since I have no errors I don't know if this is the right place
Since the retina display, suddenly this piece of drawing code seems to not work
Since session and cookies are both used to store temporary data, what is the
since last post, did all the changes suggested but this problem still haunts me.
Since I started writing this question, I think I figured out the answers to
Since I'm trying to be efficient in this program I'm making, I thought I'd
Since 10.5, Spotlight on Mac OS X has this nice Dictionary integration you might

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.