Conditional ranking algorithms for efficient object retrieval and object querying on relational data