1. A system for hash-based indexing, comprising at least one computer device that performs a method, comprising: obtaining a ranked dataset having a plurality of data items, every data item in the ranked dataset having a ranking with respect to every other data item in the ranked dataset; creating a ranking triplet matrix having a set of ranking triplets, each ranking triplet indicating a relative ranking for a pair of data items in the ranked dataset; computing a set of hash codes for the plurality of data items in the ranked dataset; merging the ranking triplet matrix and the set of hash codes to create a ranking supervised hash function, wherein the merging further includes multiplying the set of hash codes with a negative of the ranking triplet matrix; and at least one of storing or retrieving at least one of the plurality of data items using the ranking supervised hash function.